From: Chris Lattner Date: Sat, 8 Jan 2011 22:19:21 +0000 (+0000) Subject: fix a latent bug in memcpyoptimizer that my recent patches exposed: it wasn't X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=8a629577f89869f9810065dc61afd7e4302d3e46;p=oota-llvm.git fix a latent bug in memcpyoptimizer that my recent patches exposed: it wasn't updating memdep when fusing stores together. This fixes the crash optimizing the bullet benchmark. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123091 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Transforms/Scalar/MemCpyOptimizer.cpp b/lib/Transforms/Scalar/MemCpyOptimizer.cpp index 76fab1cd281..102eab65f2f 100644 --- a/lib/Transforms/Scalar/MemCpyOptimizer.cpp +++ b/lib/Transforms/Scalar/MemCpyOptimizer.cpp @@ -456,8 +456,10 @@ Instruction *MemCpyOpt::tryMergingIntoMemset(Instruction *StartInst, // Zap all the stores. for (SmallVector::const_iterator SI = Range.TheStores.begin(), - SE = Range.TheStores.end(); SI != SE; ++SI) + SE = Range.TheStores.end(); SI != SE; ++SI) { + MD->removeInstruction(*SI); (*SI)->eraseFromParent(); + } ++NumMemSetInfer; } @@ -912,7 +914,7 @@ bool MemCpyOpt::iterateOnFunction(Function &F) { // Reprocess the instruction if desired. if (RepeatInstruction) { - --BI; + if (BI != BB->begin()) --BI; MadeChange = true; } }