[clang] [InstCombine] Canonicalize `and(zext(A), B)` into `select A, B & 1, 0` (PR #66740)

Nikita Popov via cfe-commits cfe-commits at lists.llvm.org
Tue Sep 19 01:51:25 PDT 2023


nikic wrote:

I think this is the right canonicalization at the IR level, as select allows better analysis than zext(icmp). However, this seems to be universally worse for the backend: https://llvm.godbolt.org/z/Yh7brfc8b So I think we would need an SDAG undo transform. Interestingly, this already happens for riscv64, so maybe the undo transform already exists but is not enabled for all target.

@goldsteinn What do you think?

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


More information about the cfe-commits mailing list