[llvm] [ValueTracking] Handle recursive phis in knownFPClass (PR #114008)
via llvm-commits
llvm-commits at lists.llvm.org
Tue Oct 29 07:59:05 PDT 2024
================
@@ -5999,6 +5999,21 @@ void computeKnownFPClass(const Value *V, const APInt &DemandedElts,
if (IncValue == P)
continue;
+ // If the Use is a select of this phi, use the fp class of the other
+ // operand to break the recursion.
+ Value *V;
+ if (match(IncValue, m_Select(m_Value(), m_Specific(P), m_Value(V))) ||
+ match(IncValue, m_Select(m_Value(), m_Value(V), m_Specific(P))))
+ IncValue = V;
+ // Same around 2-operand phi nodes
+ if (auto *IncPhi = dyn_cast<PHINode>(IncValue);
+ IncPhi && IncPhi->getNumIncomingValues() == 2) {
+ if (IncPhi->getIncomingValue(0) == P)
+ IncValue = IncPhi->getIncomingValue(1);
+ if (IncPhi->getIncomingValue(1) == P)
----------------
goldsteinn wrote:
nit: `else if`
https://github.com/llvm/llvm-project/pull/114008
More information about the llvm-commits
mailing list