Revert r146822 at Pete Cooper's request as it broke clang self hosting.
[oota-llvm.git] / lib / Transforms / Utils / SimplifyIndVar.cpp
index 5ee1eb189799faefc37e15146d51576392d4936c..6732a789d5f1a93c9f047b161feee58b82eff277 100644 (file)
@@ -107,8 +107,8 @@ Value *SimplifyIndvar::foldIVUser(Instruction *UseInst, Instruction *IVOperand)
 
     // Attempt to fold a binary operator with constant operand.
     // e.g. ((I + 1) >> 2) => I >> 2
-    if (IVOperand->getNumOperands() != 2 ||
-        !isa<ConstantInt>(IVOperand->getOperand(1)))
+    if (!isa<BinaryOperator>(IVOperand)
+        || !isa<ConstantInt>(IVOperand->getOperand(1)))
       return 0;
 
     IVSrc = IVOperand->getOperand(0);
@@ -221,8 +221,7 @@ void SimplifyIndvar::eliminateIVRemainder(BinaryOperator *Rem,
       return;
 
     ICmpInst *ICmp = new ICmpInst(Rem, ICmpInst::ICMP_EQ,
-                                  Rem->getOperand(0), Rem->getOperand(1),
-                                  "tmp");
+                                  Rem->getOperand(0), Rem->getOperand(1));
     SelectInst *Sel =
       SelectInst::Create(ICmp,
                          ConstantInt::get(Rem->getType(), 0),