[llvm] [ValueTracking] Compute known FPClass from dominating condition (PR #80941)
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Thu Feb 8 00:40:33 PST 2024
================
@@ -4213,9 +4213,56 @@ llvm::fcmpImpliesClass(CmpInst::Predicate Pred, const Function &F, Value *LHS,
return fcmpImpliesClass(Pred, F, LHS, *ConstRHS, LookThroughSrc);
}
-static FPClassTest computeKnownFPClassFromAssumes(const Value *V,
- const SimplifyQuery &Q) {
- FPClassTest KnownFromAssume = fcAllFlags;
+static void computeKnownFPClassFromCond(const Value *V, Value *Cond,
+ bool CondIsTrue,
+ const Instruction *CxtI,
+ KnownFPClass &KnownFromContext) {
+ CmpInst::Predicate Pred;
+ Value *LHS;
+ Value *RHS;
+ uint64_t ClassVal = 0;
+ // TODO: handle sign-bit check idiom
+ if (match(Cond, m_FCmp(Pred, m_Value(LHS), m_Value(RHS)))) {
+ const APFloat *CRHS;
+ if (match(RHS, m_APFloat(CRHS))) {
----------------
arsenm wrote:
Could move this directly into the initial m_FCmp match; however I do have a patch I was working on to generalize fcmpImpliesClass to handle non-constant cases
https://github.com/llvm/llvm-project/pull/80941
More information about the llvm-commits
mailing list