[llvm-commits] CVS: llvm/lib/Analysis/ConstantFolding.cpp

Reid Spencer reid at x10sys.com
Sun Apr 1 11:42:37 PDT 2007



Changes in directory llvm/lib/Analysis:

ConstantFolding.cpp updated: 1.21 -> 1.22
---
Log message:

The bit counting intrinsics return i32 not the operand type. This fixes
last night's regression in SingleSource/UnitTests/2005-05-11-Popcount-ffs-fls


---
Diffs of the changes:  (+3 -4)

 ConstantFolding.cpp |    7 +++----
 1 files changed, 3 insertions(+), 4 deletions(-)


Index: llvm/lib/Analysis/ConstantFolding.cpp
diff -u llvm/lib/Analysis/ConstantFolding.cpp:1.21 llvm/lib/Analysis/ConstantFolding.cpp:1.22
--- llvm/lib/Analysis/ConstantFolding.cpp:1.21	Sun Apr  1 02:35:23 2007
+++ llvm/lib/Analysis/ConstantFolding.cpp	Sun Apr  1 13:42:20 2007
@@ -433,18 +433,17 @@
           break;
       }
     } else if (ConstantInt *Op = dyn_cast<ConstantInt>(Operands[0])) {
-      const IntegerType *OpTy = cast<IntegerType>(Op->getType());
       if (Name.size() > 11 && !memcmp(&Name[0], "llvm.bswap", 10)) {
         return ConstantInt::get(Op->getValue().byteSwap());
       } else if (Name.size() > 11 && !memcmp(&Name[0],"llvm.ctpop",10)) {
         uint64_t ctpop = Op->getValue().countPopulation();
-        return ConstantInt::get(OpTy, ctpop);
+        return ConstantInt::get(Type::Int32Ty, ctpop);
       } else if (Name.size() > 10 && !memcmp(&Name[0], "llvm.cttz", 9)) {
         uint64_t cttz = Op->getValue().countTrailingZeros();
-        return ConstantInt::get(OpTy, cttz);
+        return ConstantInt::get(Type::Int32Ty, cttz);
       } else if (Name.size() > 10 && !memcmp(&Name[0], "llvm.ctlz", 9)) {
         uint64_t ctlz = Op->getValue().countLeadingZeros();
-        return ConstantInt::get(OpTy, ctlz);
+        return ConstantInt::get(Type::Int32Ty, ctlz);
       }
     }
   } else if (NumOperands == 2) {






More information about the llvm-commits mailing list