[llvm] [X86] Don't drop a redundant 32-bit `and` whose users were selected as def32 (PR #223750)

Akash Manna via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 16 07:56:29 PDT 2026


akash-manna-sky wrote:

> On AArch64 we killed off isDef32, and instead do some post-isel cleanups. It's too hard to get the predicate right. See [bccbf52](https://github.com/llvm/llvm-project/commit/bccbf5276e6ee23a427b48d80ad42ff31575c1e7) .

Agreed, the predicate is fragile. It has needed FREEZE/AssertAlign (2021), BSF/BSR (#123623), the deposit patterns (#205600), and now this. I kept this PR to the targeted fix so it stays small enough to backport. The SUBREG_TO_REG cleanup in PostprocessISelDAG that Craig mentioned looks like the right home for an X86 version of bccbf52: always select `zext i32` as `MOV32rr` and strip it when the source is a real 32-bit def. I'm happy to do that as a follow-up. What do you think? One question for it: PostprocessISelDAG is skipped at -O0, so the SDAG fallback at -O0 would keep the extra `movl`. Is that acceptable, or should the cleanup live in a MI peephole like AArch64's? 


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


More information about the llvm-commits mailing list