[llvm] [InstCombine] simplify `x (comp) ~x` (PR #73990)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Thu Nov 30 14:12:02 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
----------------
nikic wrote:
```suggestion
// X s>= ~X --> X s> -1
// X s<= ~X --> X s< 0
```
Specify final result.
https://github.com/llvm/llvm-project/pull/73990
More information about the llvm-commits
mailing list