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
This commit is contained in:
Chris Lattner 2007-06-06 01:23:55 +00:00
parent 76ea084489
commit b47f6124f4

View File

@ -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());
}