You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This specific pattern is never caught, but the cause for it is due to the original comparisons lying on different branches which InstCombine didn't account for
In many situations, missing this optimization causes multiple unnecessary branches to occur (the code I was testing with did (a & !3) + 4 * ((a & 2 != 0 && (a & 4 != 0 || a & 1 != 0)) as u8), which similarly never gets the chance to optimize this away due to the separate branches, but they remain on different branches the entire time!!)
Example code:
Resulting in the IR:
This specific pattern is never caught, but the cause for it is due to the original comparisons lying on different branches which InstCombine didn't account for
In many situations, missing this optimization causes multiple unnecessary branches to occur (the code I was testing with did
(a & !3) + 4 * ((a & 2 != 0 && (a & 4 != 0 || a & 1 != 0)) as u8)
, which similarly never gets the chance to optimize this away due to the separate branches, but they remain on different branches the entire time!!)Tested with nightly Rustc on Godbolt
Godbolt: https://godbolt.org/z/K5GP5dGq1
Alive2: https://alive2.llvm.org/ce/z/evhsnx
The text was updated successfully, but these errors were encountered: