[LLVMdev] Small problem with intrinsics

Bart Coppens Bart.Coppens at elis.ugent.be
Mon Apr 21 08:04:46 PDT 2008


Hello,

I'm getting the impression that I'm misunderstanding something about 
intrinsics. I have the following reduced testcase in mind:

declare void @llvm.memcpy.i32(i8*, i8*, i32, i32) nounwind

define void @foo(i8* %a, i8* %b, i32 %c, i32 %d) {
entry:
  ;call void @llvm.memcpy.i32( i8* %a, i8* %b, i32 %c, i32 %d )
  ;call void @llvm.memcpy.i32( i8* %a, i8* %b, i32 0, i32 0 )
  ret void
}

I compile this with

llvm-as memcpy-intrinsic.ll -f -o memcpy-intrinsic.bc && llc -f -o 
memcpy-intrinsic.s memcpy-intrinsic.bc

Now, if I uncomment the lowermost memcpy, this produces no errors. If I 
uncomment the uppermost memcpy instead, I get during lcc:

llc: /var/bcoppens/llvm/llvm-svn/llvm/include/llvm/Support/Casting.h:199: 
typename llvm::cast_retty<To, From>::ret_type llvm::cast(const Y&) [with X = 
llvm::ConstantInt, Y = llvm::Value*]: Assertion `isa<X>(Val) && "cast<Ty>() 
argument of incompatible type!"' failed.

I can't see why this would happen. Both times, the function signature I call 
is seemingly correct to my eyes. Does anybody see what I'm missing here?

Thanks,
Bart Coppens



More information about the llvm-dev mailing list