1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-23 19:23:23 +01:00

Reapply r112432, now that the real problem is addressed.

llvm-svn: 112667
This commit is contained in:
Dan Gohman 2010-08-31 22:53:17 +00:00
parent cadc463790
commit fb64948296

View File

@ -3332,11 +3332,16 @@ const SCEV *ScalarEvolution::createSCEV(Value *V) {
// LLVM IR canonical form means we need only traverse the left operands.
SmallVector<const SCEV *, 4> AddOps;
AddOps.push_back(getSCEV(U->getOperand(1)));
for (Value *Op = U->getOperand(0);
Op->getValueID() == Instruction::Add + Value::InstructionVal;
Op = U->getOperand(0)) {
for (Value *Op = U->getOperand(0); ; Op = U->getOperand(0)) {
unsigned Opcode = Op->getValueID() - Value::InstructionVal;
if (Opcode != Instruction::Add && Opcode != Instruction::Sub)
break;
U = cast<Operator>(Op);
AddOps.push_back(getSCEV(U->getOperand(1)));
const SCEV *Op1 = getSCEV(U->getOperand(1));
if (Opcode == Instruction::Sub)
AddOps.push_back(getNegativeSCEV(Op1));
else
AddOps.push_back(Op1);
}
AddOps.push_back(getSCEV(U->getOperand(0)));
return getAddExpr(AddOps);