Skip to content

Support changes to getelementptr instruction in LLVM 19 #279

@RyanGlScott

Description

@RyanGlScott

If you attempt to compile the following LLVM bitcode using llvm-as-19.1.0 and then parse it using llvm-pretty-bc-parser, it will fail:

%struct.RT = type { i8, [10 x [20 x i32]], i8 }
%struct.ST = type { i32, double, %struct.RT }

define ptr @foo(ptr %s) {
entry:
  %arrayidx = getelementptr inbounds %struct.ST, ptr %s, i64 1, i32 2, i32 1, i64 5, i64 13
  ret ptr %arrayidx
}
λ> parseBitCodeFromFile "test.bc"
Left (Error {errContext = ["FUNC_CODE_INST_GEP","@foo","FUNCTION_BLOCK","FUNCTION_BLOCK_ID","value symbol table","MODULE_BLOCK","Bitstream"], errMessage = "parseField: unable to parse record field 0 of record Record {recordCode = 43, recordFields = [FieldFixed (BitString {bsLength = NumBits 3, bsData = 3}),FieldFixed (BitString {bsLength = NumBits 4, bsData = 10}),FieldVBR (BitString {bsLength = NumBits 5, bsData = 6}),FieldVBR (BitString {bsLength = NumBits 5, bsData = 5}),FieldVBR (BitString {bsLength = NumBits 5, bsData = 4}),FieldVBR (BitString {bsLength = NumBits 5, bsData = 3}),FieldVBR (BitString {bsLength = NumBits 5, bsData = 2}),FieldVBR (BitString {bsLength = NumBits 5, bsData = 1})]}"})

I'm not entirely sure what is going on yet, but I suspect it is related to the changes brought about by this proposal. (See also #278, which is about constant getelementptr expressions rather than getelementptr instructions.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions