Describe the BugIntrinsic::get_declaration (or some other part of inkwell) seems to convert PointerType to a i64 when creating the intrinsic declaration, which doesn't pass llvm's verify, at least when there's a nocapture attribute.
To Reproduce
This example tries to get a declaration of the llvm.lifetime.start intrinsic (but doesn't even call it):
let ctx = Context::create();
let module = ctx.create_module("module");
let intrinsic = Intrinsic::find("llvm.lifetime.start").unwrap()
// create the declaration
.get_declaration(&module, &[
ctx.i64_type().as_basic_type_enum(),
ctx.ptr_type(AddressSpace::default()).as_basic_type_enum()
]);
// print the LLVM IR to stderr
module.print_to_stderr();
// attempt to verify (will panic)
module.verify().unwrap()
Which then throws the following error when verifying: Attribute 'nocapture' applied to incompatible type! ptr @llvm.lifetime.start.i64.p0
Expected Behavior
I expected that code to generate a declaration which accepts a i64 and a ptr, and of course that it wouldn't throw a verification error.
LLVM Version:
LLVM Version: 17.0.6
Inkwell Branch Used: the crate feature is llvm17-0-prefer-static. I assume that's what I'm supposed to put here 😅
Describe the Bug
Intrinsic::get_declaration
(or some other part of inkwell) seems to convertPointerType
to ai64
when creating the intrinsic declaration, which doesn't pass llvm's verify, at least when there's anocapture
attribute.To Reproduce This example tries to get a declaration of the llvm.lifetime.start intrinsic (but doesn't even call it):
This generates the following LLVM IR:
Which then throws the following error when verifying:
Attribute 'nocapture' applied to incompatible type! ptr @llvm.lifetime.start.i64.p0
Expected Behavior I expected that code to generate a declaration which accepts a
i64
and aptr
, and of course that it wouldn't throw a verification error.LLVM Version:
llvm17-0-prefer-static
. I assume that's what I'm supposed to put here 😅Desktop: