aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Analysis/ValueTracking.cpp
diff options
context:
space:
mode:
authorRamkumar Ramachandra <ramkumar.ramachandra@codasip.com>2025-01-11 09:08:57 +0000
committerGitHub <noreply@github.com>2025-01-11 09:08:57 +0000
commitf38c40bff399fda9cbed522816f7ddd18f6c0918 (patch)
tree9620e93dc7a78c644f4c39ade2f8ffb58a59e406 /llvm/lib/Analysis/ValueTracking.cpp
parent212cba0ef37dd3b2a253c063240370de42fc67c1 (diff)
downloadllvm-f38c40bff399fda9cbed522816f7ddd18f6c0918.zip
llvm-f38c40bff399fda9cbed522816f7ddd18f6c0918.tar.gz
llvm-f38c40bff399fda9cbed522816f7ddd18f6c0918.tar.bz2
VT: teach isImpliedCondMatchingOperands about samesign (#122474)
Move isImplied{True,False}ByMatchingCmp from CmpInst to ICmpInst, so that it can operate on CmpPredicate instead of CmpInst::Predicate, and teach it about samesign. There are two callers of this function, and we choose to migrate the one in ValueTracking, namely isImpliedCondMatchingOperands to CmpPredicate, hence teaching it about samesign, with visible test impact.
Diffstat (limited to 'llvm/lib/Analysis/ValueTracking.cpp')
-rw-r--r--llvm/lib/Analysis/ValueTracking.cpp9
1 files changed, 4 insertions, 5 deletions
diff --git a/llvm/lib/Analysis/ValueTracking.cpp b/llvm/lib/Analysis/ValueTracking.cpp
index 4b246c0..92338d3 100644
--- a/llvm/lib/Analysis/ValueTracking.cpp
+++ b/llvm/lib/Analysis/ValueTracking.cpp
@@ -9387,12 +9387,11 @@ isImpliedCondOperands(CmpInst::Predicate Pred, const Value *ALHS,
/// Return true if "icmp1 LPred X, Y" implies "icmp2 RPred X, Y" is true.
/// Return false if "icmp1 LPred X, Y" implies "icmp2 RPred X, Y" is false.
/// Otherwise, return std::nullopt if we can't infer anything.
-static std::optional<bool>
-isImpliedCondMatchingOperands(CmpInst::Predicate LPred,
- CmpInst::Predicate RPred) {
- if (CmpInst::isImpliedTrueByMatchingCmp(LPred, RPred))
+static std::optional<bool> isImpliedCondMatchingOperands(CmpPredicate LPred,
+ CmpPredicate RPred) {
+ if (ICmpInst::isImpliedTrueByMatchingCmp(LPred, RPred))
return true;
- if (CmpInst::isImpliedFalseByMatchingCmp(LPred, RPred))
+ if (ICmpInst::isImpliedFalseByMatchingCmp(LPred, RPred))
return false;
return std::nullopt;