Implement LoopStrengthReduce/share_code_in_preheader.ll by having one

rewriter for all code inserted into the preheader, which is never flushed.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22702 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner 2005-08-08 05:47:49 +00:00
parent 8e2dbb6646
commit 5272f3c669

View File

@ -542,6 +542,8 @@ void LoopStrengthReduce::StrengthReduceStridedIVUsers(Value *Stride,
}
SCEVExpander Rewriter(*SE, *LI);
SCEVExpander PreheaderRewriter(*SE, *LI);
BasicBlock *Preheader = L->getLoopPreheader();
Instruction *PreInsertPt = Preheader->getTerminator();
Instruction *PhiInsertBefore = L->getHeader()->begin();
@ -578,7 +580,8 @@ void LoopStrengthReduce::StrengthReduceStridedIVUsers(Value *Stride,
// Emit the initial base value into the loop preheader, and add it to the
// Phi node.
Value *BaseV = Rewriter.expandCodeFor(Base, PreInsertPt, ReplacedTy);
Value *BaseV = PreheaderRewriter.expandCodeFor(Base, PreInsertPt,
ReplacedTy);
NewPHI->addIncoming(BaseV, Preheader);
// Emit the increment of the base value before the terminator of the loop