summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms
diff options
context:
space:
mode:
authorAhmed Bougacha <ahmed.bougacha@gmail.com>2015-05-20 23:55:16 +0000
committerAhmed Bougacha <ahmed.bougacha@gmail.com>2015-05-20 23:55:16 +0000
commit5e0f425c277e1f770f5ac56e4091bbfca280ee91 (patch)
tree9f3a7c669b0749c624795c5a6594a59026aff209 /llvm/lib/Transforms
parentb103c0321f46deb31f82ea4e7069d1f5e521c0fc (diff)
downloadbcm5719-llvm-5e0f425c277e1f770f5ac56e4091bbfca280ee91.tar.gz
bcm5719-llvm-5e0f425c277e1f770f5ac56e4091bbfca280ee91.zip
[MemCpyOpt] Don't move the memset when optimizing memset+memcpy.
Fixes PR23599, another miscompile introduced by r235232: when there is another dependency on the destination of the created memset (i.e., the part of the original destination that the memcpy doesn't depend on) between the memcpy and the original memset, we would insert the created memset after the memcpy, and thus after the other dependency. Instead, insert the created memset right after the old one. llvm-svn: 237858
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r--llvm/lib/Transforms/Scalar/MemCpyOptimizer.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/llvm/lib/Transforms/Scalar/MemCpyOptimizer.cpp b/llvm/lib/Transforms/Scalar/MemCpyOptimizer.cpp
index 7ac968159c5..ae5501e5884 100644
--- a/llvm/lib/Transforms/Scalar/MemCpyOptimizer.cpp
+++ b/llvm/lib/Transforms/Scalar/MemCpyOptimizer.cpp
@@ -874,7 +874,7 @@ bool MemCpyOpt::processMemSetMemCpyDependence(MemCpyInst *MemCpy,
if (ConstantInt *SrcSizeC = dyn_cast<ConstantInt>(SrcSize))
Align = MinAlign(SrcSizeC->getZExtValue(), DestAlign);
- IRBuilder<> Builder(MemCpy->getNextNode());
+ IRBuilder<> Builder(MemSet->getNextNode());
// If the sizes have different types, zext the smaller one.
if (DestSize->getType() != SrcSize->getType()) {
OpenPOWER on IntegriCloud