1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-24 03:33:20 +01:00

Add an extra safety check in front of the optimization in r141442.

llvm-svn: 141470
This commit is contained in:
Andrew Trick 2011-10-08 02:16:39 +00:00
parent a2a555b0fc
commit 430029d79a

View File

@ -908,6 +908,15 @@ bool SCEVExpander::isExpandedAddRecExprPHI(PHINode *PN, Instruction *IncV,
if (IncV->getType() != Type::getInt1PtrTy(SE.getContext(), AS)
&& IncV->getType() != Type::getInt8PtrTy(SE.getContext(), AS))
return false;
// Ensure the operands dominate the insertion point. I don't know of a
// case when this would not be true, so this is somewhat untested.
if (L == IVIncInsertLoop) {
for (User::op_iterator OI = IncV->op_begin()+1,
OE = IncV->op_end(); OI != OE; ++OI)
if (Instruction *OInst = dyn_cast<Instruction>(OI))
if (!SE.DT->dominates(OInst, IVIncInsertPos))
return false;
}
break;
}
IncV = dyn_cast<Instruction>(IncV->getOperand(0));