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
Missing optimization for switch from int to bool #56189
Comments
Alive2 link for convenience: https://alive2.llvm.org/ce/z/3m384E (for this specific case, not a general proof) |
Thanks for the bug report! One way to think about this is as a special case of:
LLVM will essentially generate
but we could avoid the subtraction if we grew the table by synthesizing a |
Try to use the original value as an index (in the lookup table) in more cases (to avoid one subtraction and shorten the dependency chain) (#56189). Test plan: 1/ ninja check-all 2/ bootstrapped LLVM + Clang pass tests Differential revision: https://reviews.llvm.org/D128897
Try to use the original value as an index (in the lookup table) in more cases (to avoid one subtraction and shorten the dependency chain) (llvm/llvm-project#56189). Test plan: 1/ ninja check-all 2/ bootstrapped LLVM + Clang pass tests Differential revision: https://reviews.llvm.org/D128897
Consider a function like:
My clang/LLVM build gives back:
This is sort-of like writing:
I think this could be simplified further to:
For clarity, this is as-if we wrote the code initially as:
The text was updated successfully, but these errors were encountered: