[llvm] [IR] Truncate struct field offsets exceeding the pointer index width. (PR #213436)

Yingwei Zheng via llvm-commits llvm-commits at lists.llvm.org
Sat Aug 1 09:51:19 PDT 2026


https://github.com/dtcxzyw approved this pull request.

LGTM.

I just noticed that llubi has the same issue: https://github.com/llvm/llvm-project/blob/6dfd7337239f82e19aad65a899e862bf31a8b180/llvm/tools/llubi/lib/Context.cpp#L1057

It would be nice if you can also post a fix for llubi :)
```
; RUN: llubi --verbose < %s 2>&1 | FileCheck %s

target datalayout = "e-m:e-p:16:16"

%s = type { [65536 x i8], i8 }

; Offset of the struct's second field does not fit into a 16 bit pointer.
define void @main() {
  %p = alloca i32
  %a = getelementptr %s, ptr %p, i32 0, i32 1
  ret void
}
```


https://github.com/llvm/llvm-project/pull/213436


More information about the llvm-commits mailing list