[llvm] [InstCombine] Remove `sub nuw C_Mask, X` -> `xor X, C_Mask` canoncalization (PR #122607)

via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 15 08:44:55 PST 2025


goldsteinn wrote:

> Are you sure this is worth pursuing? I expect this is going to be something of a mixed bag even after some effort to mitigate regressions. Note that the llvm-opt-benchmark results seem to be the same before and after you added a bunch of XorLike checks, so I'm not sure that direction is really helpful to mitigate regressions in practice (and we should not perform a mass-conversion without evidence that it is).

I think there are very likely some regressions caused by `sub nuw` -> `xor`, although I agree not all the regressions of dropping the `xor` form are due to missing folds on InstCombine. Either way, however, I think it's more principalled to pick one of these forms (and I think `sub nuw` is clearly preferable as it doesn't drop any information) than this somewhat weak and inconsistent canonicalization we have now.

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


More information about the llvm-commits mailing list