[llvm-branch-commits] [llvm] [AMDGPU] Fold provably out-of-bounds raw buffer loads/stores (PR #227402)

Dark Steve via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Sun Oct 4 20:02:04 PDT 2026


PrasoonMishra wrote:

@arsenm Yes, as @krzysz00 also pointed out, this misses fat pointer accesses. LowerBufferFatPointers runs very late in the pipeline and after InstCombine. I'll refactor the OOB check for folding into a shared utility and use it from both InstCombine and the fat pointer lowering, so both paths are covered.

For regular load/store, InstCombine doesn't remove OOB in general. OOB is UB there. It folds provably invalid accesses ([null or undef pointers became unreachable)](https://github.com/llvm/llvm-project/blob/main/llvm/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp#L1133-L1139) and loads past the end of a [constant global fold to poison.](https://github.com/llvm/llvm-project/blob/main/llvm/lib/Analysis/ConstantFolding.cpp#L852-L856)

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


More information about the llvm-branch-commits mailing list