aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Transforms
diff options
context:
space:
mode:
authorOwen Anderson <resistor@mac.com>2008-04-29 21:26:06 +0000
committerOwen Anderson <resistor@mac.com>2008-04-29 21:26:06 +0000
commita6a38aa5a5b6c31981f574479d734bf60de1e4d8 (patch)
tree44fe6fef30ab0ade1fffb7605e2acf6837b7d7b8 /lib/Transforms
parente35bf0dc2f9770fad75e26d4433ef4efc07c54d0 (diff)
downloadexternal_llvm-a6a38aa5a5b6c31981f574479d734bf60de1e4d8.zip
external_llvm-a6a38aa5a5b6c31981f574479d734bf60de1e4d8.tar.gz
external_llvm-a6a38aa5a5b6c31981f574479d734bf60de1e4d8.tar.bz2
Fix a bug in memcpyopt where the memcpy-memcpy transform was never being applied because
we were checking for it in the wrong order. This caused a miscompilation because the return slot optimization assumes that the call it is dealing with is NOT a memcpy. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50444 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms')
-rw-r--r--lib/Transforms/Scalar/MemCpyOptimizer.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/Transforms/Scalar/MemCpyOptimizer.cpp b/lib/Transforms/Scalar/MemCpyOptimizer.cpp
index d2723ab..9a39c8f 100644
--- a/lib/Transforms/Scalar/MemCpyOptimizer.cpp
+++ b/lib/Transforms/Scalar/MemCpyOptimizer.cpp
@@ -615,10 +615,12 @@ bool MemCpyOpt::processMemCpy(MemCpyInst* M) {
if (dep == MemoryDependenceAnalysis::None ||
dep == MemoryDependenceAnalysis::NonLocal)
return false;
- else if (CallInst* C = dyn_cast<CallInst>(dep))
- return performCallSlotOptzn(M, C);
- else if (!isa<MemCpyInst>(dep))
- return false;
+ else if (!isa<MemCpyInst>(dep)) {
+ if (CallInst* C = dyn_cast<CallInst>(dep))
+ return performCallSlotOptzn(M, C);
+ else
+ return false;
+ }
MemCpyInst* MDep = cast<MemCpyInst>(dep);