aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Analysis/ValueTracking.cpp
diff options
context:
space:
mode:
authorPhilip Reames <preames@rivosinc.com>2023-09-01 12:10:32 -0700
committerPhilip Reames <listmail@philipreames.com>2023-09-01 12:17:36 -0700
commit294ad08ecc0085e3ae93bbd16d488f284fe0d8fb (patch)
treefdee5ad3cd0bf4b74c929fe03548bbb99d8e21d9 /llvm/lib/Analysis/ValueTracking.cpp
parent3e67d7b682deaa05ac79490d43d4050e10d04a40 (diff)
downloadllvm-294ad08ecc0085e3ae93bbd16d488f284fe0d8fb.zip
llvm-294ad08ecc0085e3ae93bbd16d488f284fe0d8fb.tar.gz
llvm-294ad08ecc0085e3ae93bbd16d488f284fe0d8fb.tar.bz2
Revert "Revert "InstSimplify: Use correct interested FP classes when simplifying fcmp""
This reverts commit 89f0314ee14a4d7f5a92fd63574ba545863df016. Change does not build.
Diffstat (limited to 'llvm/lib/Analysis/ValueTracking.cpp')
-rw-r--r--llvm/lib/Analysis/ValueTracking.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/llvm/lib/Analysis/ValueTracking.cpp b/llvm/lib/Analysis/ValueTracking.cpp
index 0c31dc2..801814e 100644
--- a/llvm/lib/Analysis/ValueTracking.cpp
+++ b/llvm/lib/Analysis/ValueTracking.cpp
@@ -4007,9 +4007,15 @@ std::pair<Value *, FPClassTest> llvm::fcmpToClassTest(FCmpInst::Predicate Pred,
Value *LHS, Value *RHS,
bool LookThroughSrc) {
const APFloat *ConstRHS;
- if (!match(RHS, m_APFloat(ConstRHS)))
+ if (!match(RHS, m_APFloatAllowUndef(ConstRHS)))
return {nullptr, fcNone};
+ return fcmpToClassTest(Pred, F, LHS, ConstRHS, LookThroughSrc);
+}
+
+std::pair<Value *, FPClassTest>
+llvm::fcmpToClassTest(FCmpInst::Predicate Pred, const Function &F, Value *LHS,
+ const APFloat *ConstRHS, bool LookThroughSrc) {
// fcmp ord x, zero|normal|subnormal|inf -> ~fcNan
if (Pred == FCmpInst::FCMP_ORD && !ConstRHS->isNaN())
return {LHS, ~fcNan};