For PR1297:
authorReid Spencer <rspencer@reidspencer.com>
Mon, 2 Apr 2007 01:01:49 +0000 (01:01 +0000)
committerReid Spencer <rspencer@reidspencer.com>
Mon, 2 Apr 2007 01:01:49 +0000 (01:01 +0000)
Make sure that the CTPOP result is casted to i32 as the bit counting
intrinsics all return i32 now (this affects CTLZ and CTTZ as well).

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

lib/CodeGen/IntrinsicLowering.cpp

index 21b0e514ef6c8c3725b9e472da4c01d183e55dfb..7b772d78f279d8ed8ba504caa0727d47a34ce1e1 100644 (file)
@@ -218,7 +218,7 @@ static Value *LowerCTPOP(Value *V, Instruction *IP) {
     V = BinaryOperator::createAdd(LHS, RHS, "ctpop.step", IP);
   }
 
-  return V;
+  return CastInst::createIntegerCast(V, Type::Int32Ty, false, "ctpop", IP);
 }
 
 /// LowerCTLZ - Emit the code to lower ctlz of V before the specified