[llvm] ValueTracking: Account for undef in adjustKnownFPClassForSelectArm (PR #175372)

Yingwei Zheng via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 12 08:45:30 PST 2026


================
@@ -4872,11 +4872,16 @@ void llvm::adjustKnownFPClassForSelectArm(KnownFPClass &Known, Value *Cond,
                                           Value *Arm, bool Invert,
                                           const SimplifyQuery &SQ,
                                           unsigned Depth) {
+
+  KnownFPClass KnownSrc;
   computeKnownFPClassFromCond(Arm, Cond,
-                              /*CondIsTrue=*/!Invert, SQ.CxtI, Known,
+                              /*CondIsTrue=*/!Invert, SQ.CxtI, KnownSrc,
                               Depth + 1);
-  // TODO: Do we need to check isGuaranteedNotToBeUndef, like the KnownBits
-  // case?
+  if (KnownSrc.isUnknown())
+    return;
+
+  if (isGuaranteedNotToBeUndef(Arm, SQ.AC, SQ.CxtI, SQ.DT, Depth + 1))
+    Known = KnownSrc;
----------------
dtcxzyw wrote:

`adjustKnownBitsForSelectArm` uses unionWith. https://github.com/llvm/llvm-project/blob/f6d0a512972a74ef100723b9526a6a0ddb23f894/llvm/lib/Analysis/ValueTracking.cpp#L1318-L1320

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


More information about the llvm-commits mailing list