fix a regression compiling SingleSource/UnitTests/2005-05-11-Popcount-ffs-fls,
introduced by chandler's recent patches.
llvm-svn: 40862
diff --git a/llvm-gcc-4.0/gcc/llvm-convert.cpp b/llvm-gcc-4.0/gcc/llvm-convert.cpp
index 6a50c5d..8fdb057 100644
--- a/llvm-gcc-4.0/gcc/llvm-convert.cpp
+++ b/llvm-gcc-4.0/gcc/llvm-convert.cpp
@@ -4303,11 +4303,12 @@
// the ffs, but should ignore the return type of ffs.
Value *Amt = Emit(TREE_VALUE(TREE_OPERAND(exp, 1)), 0);
EmitBuiltinUnaryIntOp(Amt, Result, Intrinsic::cttz);
- Result = Builder.CreateAdd(Result, ConstantInt::get(Type::Int32Ty, 1),
+ Result = Builder.CreateAdd(Result, ConstantInt::get(Result->getType(), 1),
"tmp");
Value *Cond =
Builder.CreateICmpEQ(Amt, Constant::getNullValue(Amt->getType()), "tmp");
- Result = Builder.CreateSelect(Cond, Constant::getNullValue(Type::Int32Ty),
+ Result = Builder.CreateSelect(Cond,
+ Constant::getNullValue(Result->getType()),
Result, "tmp");
return true;
}
@@ -4347,13 +4348,9 @@
// varying type. Make sure that we specify the actual type for "iAny"
// by passing it as the 3rd and 4th parameters. This isn't needed for
// most intrinsics, but is needed for ctpop, cttz, ctlz.
- const Type* Tys[] = {
- InVal->getType()
- };
- Result = Builder.CreateCall(Intrinsic::getDeclaration(TheModule, Id, Tys,
- sizeof(Tys)/sizeof(Tys[0])),
- InVal, "tmp");
-
+ const Type *Ty = InVal->getType();
+ Result = Builder.CreateCall(Intrinsic::getDeclaration(TheModule, Id, &Ty, 1),
+ InVal, "tmp");
return true;
}