[llvm] [GISel] Use GISelValueTracking in isKnownNeverNaN (PR #190542)

Tim Gymnich via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 10 04:54:39 PDT 2026


================
@@ -1877,6 +1819,39 @@ void GISelValueTracking::computeKnownFPClass(Register R,
     }
     break;
   }
+  case TargetOpcode::G_PHI:
+  case TargetOpcode::PHI: {
+    // Cap PHI recursion below the global limit to avoid spending the entire
+    // budget chasing loop back-edges (matches ValueTracking's
+    // PhiRecursionLimit).
+    if (Depth + 2 > MaxAnalysisRecursionDepth)
+      break;
+    // PHI's operands are a mix of registers and basic blocks interleaved.
+    // We only care about the register ones.
+    bool First = true;
+    for (unsigned Idx = 1; Idx < MI.getNumOperands(); Idx += 2) {
+      const MachineOperand &Src = MI.getOperand(Idx);
+      Register SrcReg = Src.getReg();
+      LLT SrcTy = MRI.getType(SrcReg);
+      if (!SrcReg.isVirtual() || Src.getSubReg() != 0 || !SrcTy.isValid()) {
----------------
tgymnich wrote:

removed

https://github.com/llvm/llvm-project/pull/190542


More information about the llvm-commits mailing list