[llvm] [InstCombine] simplify `icmp pred x, ~x` (PR #73990)

Yingwei Zheng via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 7 22:59:40 PST 2023


================
@@ -7035,6 +7035,51 @@ Instruction *InstCombinerImpl::visitICmpInst(ICmpInst &I) {
       return new ICmpInst(I.getSwappedPredicate(Pred), Builder.CreateXor(X, Y),
                           Z);
 
+    // Transform X s<  ~X  -->   X s<  0
+    //           X s>  ~X  -->   X s>  -1
+    //           X s>= ~X  -->   X s>  -1
+    //           X s<= ~X  -->   X s<  0
+    //           X u<  ~X  -->   X s>  -1
----------------
dtcxzyw wrote:

Please update the alive2 link in your PR description to match the comment here.


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


More information about the llvm-commits mailing list