Use isUnitValue() instead of getZExtValue() == 1 which will prevent an
authorReid Spencer <rspencer@reidspencer.com>
Thu, 1 Mar 2007 21:51:23 +0000 (21:51 +0000)
committerReid Spencer <rspencer@reidspencer.com>
Thu, 1 Mar 2007 21:51:23 +0000 (21:51 +0000)
assert if the ConstantInt's value is large.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34814 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/Scalar/Reassociate.cpp

index e1dbb9b0d1bad111347d387cf6f45716c021503b..aa851b290f46267e49f15d657188da9dc92ac3a3 100644 (file)
@@ -547,7 +547,7 @@ Value *Reassociate::OptimizeExpression(BinaryOperator *I,
       if (CstVal->isNullValue()) {           // ... * 0 -> 0
         ++NumAnnihil;
         return CstVal;
-      } else if (cast<ConstantInt>(CstVal)->getZExtValue() == 1) {
+      } else if (cast<ConstantInt>(CstVal)->isUnitValue()) {
         Ops.pop_back();                      // ... * 1 -> ...
       }
       break;