diff options
author | Reid Spencer <rspencer@reidspencer.com> | 2007-04-01 18:42:20 +0000 |
---|---|---|
committer | Reid Spencer <rspencer@reidspencer.com> | 2007-04-01 18:42:20 +0000 |
commit | e613555fd9184414fb586e4df3d6a4c716724c66 (patch) | |
tree | 5d79f313800ffeedc38ece4b6b99498d332460c6 /lib/Analysis/ConstantFolding.cpp | |
parent | 3a507fda84a90a81490e5daed03c9a247bb74aaf (diff) |
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
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35556 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/ConstantFolding.cpp')
-rw-r--r-- | lib/Analysis/ConstantFolding.cpp | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/lib/Analysis/ConstantFolding.cpp b/lib/Analysis/ConstantFolding.cpp index f0bd1dd0ad..8991c24658 100644 --- a/lib/Analysis/ConstantFolding.cpp +++ b/lib/Analysis/ConstantFolding.cpp @@ -433,18 +433,17 @@ llvm::ConstantFoldCall(Function *F, Constant** Operands, unsigned NumOperands) { 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) { |