[llvm] [InstCombine] simplify `x (comp) ~x` (PR #73990)
Yingwei Zheng via llvm-commits
llvm-commits at lists.llvm.org
Fri Dec 1 17:19:38 PST 2023
================
@@ -7035,6 +7035,63 @@ 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> ~X
+ // X s<= ~X --> X s< ~X
----------------
dtcxzyw wrote:
I think we should emit `X s> -1` directly.
https://github.com/llvm/llvm-project/pull/73990
More information about the llvm-commits
mailing list