[llvm] [InstCombine] Fold icmp (zext X), (and (trunc Y), Mask) -> icmp X, trunc Y (PR #221189)
armandeep singh via llvm-commits
llvm-commits at lists.llvm.org
Tue Sep 15 12:01:43 PDT 2026
================
@@ -5327,6 +5328,36 @@ Instruction *InstCombinerImpl::foldICmpBinOp(ICmpInst &I,
Value *X;
+ // Catch the mirrored operand order: icmp Pred (and (trunc Y), Mask), (zext
+ // X). Canonicalization (like ugt -> ult) often swaps operands, pushing the
+ // zext to Operand 1. We need to handle this to avoid missing optimizations.
+ {
----------------
armandeep23947 wrote:
makes sense, moved it to the end.
https://github.com/llvm/llvm-project/pull/221189
More information about the llvm-commits
mailing list