[llvm] f21f2b4 - [InstCombine] Create Icmp in canonical form (NFC) (#146266)

via llvm-commits llvm-commits at lists.llvm.org
Sun Jun 29 06:08:40 PDT 2025


Author: Andreas Jonson
Date: 2025-06-29T15:08:36+02:00
New Revision: f21f2b483c4f31e8420319f1538757bd90726bdf

URL: https://github.com/llvm/llvm-project/commit/f21f2b483c4f31e8420319f1538757bd90726bdf
DIFF: https://github.com/llvm/llvm-project/commit/f21f2b483c4f31e8420319f1538757bd90726bdf.diff

LOG: [InstCombine] Create Icmp in canonical form (NFC) (#146266)

Added: 
    

Modified: 
    llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp b/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
index dce695a036006..dd16cfaeecd45 100644
--- a/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
@@ -681,7 +681,7 @@ static Value *foldLogOpOfMaskedICmps(Value *LHS, Value *RHS, bool IsAnd,
         }
         Value *NewAnd = Builder.CreateAnd(A, BD);
         Value *CEVal = ConstantInt::get(A->getType(), CE);
-        return Builder.CreateICmp(CC, CEVal, NewAnd);
+        return Builder.CreateICmp(CC, NewAnd, CEVal);
       };
 
       if (Mask & BMask_Mixed)


        


More information about the llvm-commits mailing list