[llvm] [InstSimplify] Simplify the select with integer comparison relationship (PR #66668)
via llvm-commits
llvm-commits at lists.llvm.org
Wed Oct 18 05:22:39 PDT 2023
================
@@ -8282,6 +8282,28 @@ static std::optional<bool> isImpliedCondICmps(const ICmpInst *LHS,
if (areMatchingOperands(L0, L1, R0, R1, AreSwappedOps))
return isImpliedCondMatchingOperands(LPred, RPred, AreSwappedOps);
+ if (RPred == ICmpInst::ICMP_SLE) {
+ Value *X;
+ Value *Y;
+ // x -nsw y <= -1 <==> x < y
----------------
vfdff wrote:
you'll see now we also can't optimize the following case
```
#include <stdlib.h>
int test_slt (int x, int y) {
return x<y ? abs (x-y+1): 0; // here `x-y+1 <= 0`
}
```
https://github.com/llvm/llvm-project/pull/66668
More information about the llvm-commits
mailing list