diff options
author | Chris Lattner <sabre@nondot.org> | 2007-06-06 01:23:55 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2007-06-06 01:23:55 +0000 |
commit | b47f6124f4893c00573d1a5be56a6e4cf877faeb (patch) | |
tree | a4a052e80d8da67a25ec620eba4e44a0736d2fa0 /lib | |
parent | 76ea084489baa1e5a5dff2e0186a1284d4df3c91 (diff) |
Fix PR1495 and CodeGen/X86/2007-06-05-LSR-Dominator.ll
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37454 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Transforms/Scalar/LoopStrengthReduce.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/Transforms/Scalar/LoopStrengthReduce.cpp b/lib/Transforms/Scalar/LoopStrengthReduce.cpp index 449cee3bda..5c007551af 100644 --- a/lib/Transforms/Scalar/LoopStrengthReduce.cpp +++ b/lib/Transforms/Scalar/LoopStrengthReduce.cpp @@ -560,11 +560,17 @@ Value *BasedUser::InsertCodeForBaseAtPosition(const SCEVHandle &NewBase, OperandValToReplace->getType()); Value *Base = Rewriter.expandCodeFor(NewBase, BaseInsertPt); + + // If we are inserting the base and imm values in the same block, make sure to + // adjust the IP position if insertion reused a result. + if (IP == BaseInsertPt) + IP = Rewriter.getInsertionPoint(); // Always emit the immediate (if non-zero) into the same block as the user. SCEVHandle NewValSCEV = SCEVAddExpr::get(SCEVUnknown::get(Base), Imm); return Rewriter.expandCodeFor(NewValSCEV, IP, OperandValToReplace->getType()); + } |