Revert r112432. It appears to be exposing a problem in the emacs build.
authorDan Gohman <gohman@apple.com>
Tue, 31 Aug 2010 20:58:44 +0000 (20:58 +0000)
committerDan Gohman <gohman@apple.com>
Tue, 31 Aug 2010 20:58:44 +0000 (20:58 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112638 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Analysis/ScalarEvolution.cpp

index 121c6e2a3270a35761b0f562a0921af677eb09ae..863f8a65409cf4df0c7afa9d93008d0341fdecb9 100644 (file)
@@ -3332,16 +3332,11 @@ 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 = U->getOperand(0)) {
-      unsigned Opcode = Op->getValueID() - Value::InstructionVal;
-      if (Opcode != Instruction::Add && Opcode != Instruction::Sub)
-        break;
+    for (Value *Op = U->getOperand(0);
+         Op->getValueID() == Instruction::Add + Value::InstructionVal;
+         Op = U->getOperand(0)) {
       U = cast<Operator>(Op);
-      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(1)));
     }
     AddOps.push_back(getSCEV(U->getOperand(0)));
     return getAddExpr(AddOps);