[LLVMdev] Can't invoke an intrinsic?

Chris Lattner sabre at nondot.org
Sun Apr 27 13:10:32 PDT 2008


On Apr 26, 2008, at 8:21 PM, Talin wrote:

> In line 1157 of Verifier.cpp, there is this code:
>
>      Assert1(!F->isIntrinsic() || (i == 0 && isa<CallInst>(I)),
>              "Cannot take the address of an intrinsic!", &I);
>
> This check appears to have a problem with this line:
>
>        invoke void @llvm.memcpy.i32( i8* %._items.i.i, i8*
> %._items2.i.i, i32 ptrtoint (i32* getelementptr ([0 x i32]* null,  
> i32 0,
> i32 4) to i32), i32 1 )
>                        to label %UnifiedReturnBlock unwind label  
> %failure
>
> ...in other words, it appears to be implying that it's not OK to use
> 'invoke' on an intrinsic. Is that correct?

It's correct.

> I should mention also that the code snipped above was produced by  
> LLVM's
> optimizer, in my original code the call to memcpy was a call, not an
> invoke. So if it is indeed illegal to invoke intrinsics, the optimizer
> should be informed of this fact :)

Make sure your front-end declares the intrinsic 'nounwind'.  If you're  
using the C++ API, use Intrinsic::getDeclaration(..) and it will  
automatically do this for you.

-Chris



More information about the llvm-dev mailing list