Skip to content

LLVM 20 assertion failed: value.is_instruction() #613

@thetayloredman

Description

@thetayloredman

Describe the Bug
When calling insert_declare_at_end, the assertion for PointerValue :: is_instruction() fails, even though the PointerValue was generated via an alloca.

To Reproduce
Call insert_declare_at_end with these arguments:

[compiler/zrc_codegen/src/program.rs:375:21] &(alloc, Some(decl), None::<DIExpression<'_>>, id_debug_location, entry) = (
    PointerValue {
        ptr_value: Value {
            name: "arg_n",
            address: 0x0000000107f6fff0,
            is_const: false,
            is_null: false,
            is_undef: false,
            llvm_value: "  %arg_n = alloca i32, align 4, !dbg !9",
            llvm_type: "ptr",
        },
    },
    Some(
        DILocalVariable {
            metadata_ref: 0x0000000107f70078,
            _marker: PhantomData<&inkwell::context::Context>,
        },
    ),
    None,
    DILocation {
        metadata_ref: 0x0000000bfd0b2ef8,
        _marker: PhantomData<&inkwell::context::Context>,
    },
    BasicBlock {
        address: 0x0000000107f6ff50,
        is_const: false,
        llvm_value: "\nentry:\n  %arg_n = alloca i32, align 4, !dbg !9\n  store i32 %0, ptr %arg_n, align 4, !dbg !9\n",
        llvm_type: "label",
    },
)

Expected Behavior
Not to panic

LLVM Version (please complete the following information):

  • LLVM Version: llvm 20.1
  • Inkwell Branch Used: llvm20-1 @ HEAD

Desktop (please complete the following information):

  • OS: macOS 26, arm64

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions