diff options
author | Siyuan Zhu <timeorange7071@outlook.com> | 2023-05-04 16:59:07 +0200 |
---|---|---|
committer | Nikita Popov <npopov@redhat.com> | 2023-05-04 16:59:07 +0200 |
commit | edcdc81e2bb39ff8bf6c326c24f4b70e9eebea3d (patch) | |
tree | 17deedf216fe4bec72e15cb92931ec5aaede1a63 /llvm/lib/Analysis/ValueTracking.cpp | |
parent | 2444fb93e605ba515e4528823ace8a873dc1ba20 (diff) | |
download | llvm-edcdc81e2bb39ff8bf6c326c24f4b70e9eebea3d.zip llvm-edcdc81e2bb39ff8bf6c326c24f4b70e9eebea3d.tar.gz llvm-edcdc81e2bb39ff8bf6c326c24f4b70e9eebea3d.tar.bz2 |
[ValueTracking] add UGT/UGE and SGT/SGE in `isImpliedCondOperands`
Partially `fix` https://github.com/llvm/llvm-project/issues/62441.
Extend isImpliedCondOperands() to handle ugt/uge and sgt/sge predicates.
alive2 proof: https://alive2.llvm.org/ce/z/jLFDAv and
https://alive2.llvm.org/ce/z/Z8idUd
Differential Revision: https://reviews.llvm.org/D149510
Diffstat (limited to 'llvm/lib/Analysis/ValueTracking.cpp')
-rw-r--r-- | llvm/lib/Analysis/ValueTracking.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/llvm/lib/Analysis/ValueTracking.cpp b/llvm/lib/Analysis/ValueTracking.cpp index ec05fa9..1a15ad4 100644 --- a/llvm/lib/Analysis/ValueTracking.cpp +++ b/llvm/lib/Analysis/ValueTracking.cpp @@ -8144,12 +8144,26 @@ isImpliedCondOperands(CmpInst::Predicate Pred, const Value *ALHS, return true; return std::nullopt; + case CmpInst::ICMP_SGT: + case CmpInst::ICMP_SGE: + if (isTruePredicate(CmpInst::ICMP_SLE, ALHS, BLHS, DL, Depth) && + isTruePredicate(CmpInst::ICMP_SLE, BRHS, ARHS, DL, Depth)) + return true; + return std::nullopt; + case CmpInst::ICMP_ULT: case CmpInst::ICMP_ULE: if (isTruePredicate(CmpInst::ICMP_ULE, BLHS, ALHS, DL, Depth) && isTruePredicate(CmpInst::ICMP_ULE, ARHS, BRHS, DL, Depth)) return true; return std::nullopt; + + case CmpInst::ICMP_UGT: + case CmpInst::ICMP_UGE: + if (isTruePredicate(CmpInst::ICMP_ULE, ALHS, BLHS, DL, Depth) && + isTruePredicate(CmpInst::ICMP_ULE, BRHS, ARHS, DL, Depth)) + return true; + return std::nullopt; } } |