[llvm] [ConstantFolding] Bail out when reading padding of type (PR #144330)

Yingwei Zheng via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 16 06:39:23 PDT 2025


https://github.com/dtcxzyw commented:

It is weird to me that the following load (across the padding) gets folded into 0.
```
@i40_struct = constant { i40, i8 } { i40 0, i8 1 }
define i16 @load_i40_struct_padding() {
  %v = load i16, ptr getelementptr (i8, ptr @i40_struct, i64 4) ; [4, 6)
  ret i16 %v
}
```
I think it is ok to always return zero, as the padding is initialized with undef.


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


More information about the llvm-commits mailing list