Use APInt safe isOne() method on ConstantInt instead of getZExtValue()==1
authorReid Spencer <rspencer@reidspencer.com>
Fri, 2 Mar 2007 23:03:17 +0000 (23:03 +0000)
committerReid Spencer <rspencer@reidspencer.com>
Fri, 2 Mar 2007 23:03:17 +0000 (23:03 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34854 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/Utils/LowerAllocations.cpp

index 0213daf38c7162fd45f9eee1427670759dae2e7a..8acaeed26b969a3169cc4ffb3fc4b7dbe74395e7 100644 (file)
@@ -121,7 +121,7 @@ bool LowerAllocations::runOnBasicBlock(BasicBlock &BB) {
 
       if (MI->isArrayAllocation()) {
         if (isa<ConstantInt>(MallocArg) &&
-            cast<ConstantInt>(MallocArg)->getZExtValue() == 1) {
+            cast<ConstantInt>(MallocArg)->isOne()) {
           MallocArg = MI->getOperand(0);         // Operand * 1 = Operand
         } else if (Constant *CO = dyn_cast<Constant>(MI->getOperand(0))) {
           CO = ConstantExpr::getIntegerCast(CO, IntPtrTy, false /*ZExt*/);