Use isUnitValue() instead of getZExtValue() == 1 which will prevent an

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
This commit is contained in:
Reid Spencer 2007-03-01 21:51:23 +00:00
parent 37eeaa729b
commit 4da0451821

View 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;