-
Notifications
You must be signed in to change notification settings - Fork 8
pre-commit: test PR76458 #55
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
baseline: llvm/llvm-project@fe94ae8 |
|
Regression: |
|
@dtcxzyw It's possible to fold |
Alive2: https://alive2.llvm.org/ce/z/Zy_4Dz I will post a patch later. |
|
@dtcxzyw We could avoid doing the transform if the offset is also constant. Or change clang frontend to not emit |
|
A possible miscompilation after simplifying diff: But this BB seems to be unreachable. |
296115f to
7225cd8
Compare
…se 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 (dtcxzyw/llvm-opt-benchmark#55 (comment)). 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.
…ith 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 (dtcxzyw/llvm-opt-benchmark#55 (comment)). 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.
PR Link: llvm/llvm-project#76458