diff options
author | Yingwei Zheng <dtcxzyw2333@gmail.com> | 2025-04-11 09:04:23 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-04-11 09:04:23 +0800 |
commit | 1711996805c506f5717193aaeedf3752dfdd900d (patch) | |
tree | adecc6b54c837d96c689876f6375b4b9ffae6bc4 /llvm/lib/CodeGen/MachineOperand.cpp | |
parent | d14acb78065bdd331019924feaaef52e5e744529 (diff) | |
download | llvm-1711996805c506f5717193aaeedf3752dfdd900d.zip llvm-1711996805c506f5717193aaeedf3752dfdd900d.tar.gz llvm-1711996805c506f5717193aaeedf3752dfdd900d.tar.bz2 |
[Clang][CodeGen] Do not set inbounds flag for struct GEP with null base pointers (#130734)
In the LLVM middle-end we want to fold `gep inbounds null, idx -> null`:
https://alive2.llvm.org/ce/z/5ZkPx-
This pattern is common in real-world programs
(https://github.com/dtcxzyw/llvm-opt-benchmark/pull/55#issuecomment-1870963906).
Generally, it exists in some (actually) unreachable blocks, which is
introduced by JumpThreading.
However, some old-style offsetof macros are still widely used in
real-world C/C++ code (e.g., hwloc/slurm/luajit). To avoid breaking
existing code and inconvenience to downstream users, this patch removes
the inbounds flag from the struct gep if the base pointer is null.
Diffstat (limited to 'llvm/lib/CodeGen/MachineOperand.cpp')
0 files changed, 0 insertions, 0 deletions