[llvm] [InstCombine] Make the `(icmp eq/ne (and X, Y), X)` canonicalization work for non-const operands (PR #84688)

via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 11 16:15:47 PDT 2024


================
@@ -7221,6 +7219,11 @@ Instruction *InstCombinerImpl::visitICmpInst(ICmpInst &I) {
           foldICmpCommutative(I.getSwappedPredicate(), Op1, Op0, I))
     return Res;
 
+  // Need this to be after foldICmpCommutative so we do mask folds before
+  // transforming the `and`.
----------------
goldsteinn wrote:

you are right actually, its non-nonsensical to label something a canonicalization but then have it work for less folds...

I will handle all regressions and move this back to its original place.

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


More information about the llvm-commits mailing list