[llvm-commits] [127541] commit reid's intrinsics patch
clattner at apple.com
clattner at apple.com
Tue May 22 22:10:54 PDT 2007
Revision: 127541
Author: clattner
Date: 2007-05-22 22:10:53 -0700 (Tue, 22 May 2007)
Log Message:
-----------
commit reid's intrinsics patch
Modified Paths:
--------------
apple-local/branches/llvm/gcc/llvm-convert.cpp
Modified: apple-local/branches/llvm/gcc/llvm-convert.cpp
===================================================================
--- apple-local/branches/llvm/gcc/llvm-convert.cpp 2007-05-22 16:31:00 UTC (rev 127540)
+++ apple-local/branches/llvm/gcc/llvm-convert.cpp 2007-05-23 05:10:53 UTC (rev 127541)
@@ -4201,12 +4201,15 @@
bool TreeToLLVM::EmitBuiltinUnaryIntOp(Value *InVal, Value *&Result,
Intrinsic::ID Id) {
- const Type *Ty = InVal->getType();
-
- const Type* Tys[2];
- Tys[0] = 0; // Result type is i32, not variable, signal so.
- Tys[1] = Ty; // Parameter type is iAny so actual type must be specified here
- Result = new CallInst(Intrinsic::getDeclaration(TheModule, Id, Tys, 2),
+ // The intrinsic might be overloaded in which case the argument is of
+ // 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 = new CallInst(Intrinsic::getDeclaration(TheModule, Id, Tys,
+ sizeof(Tys)/sizeof(Tys[0])),
InVal, "tmp", CurBB);
return true;
More information about the llvm-commits
mailing list