[llvm-branch-commits] [llvm] InstCombine: Handle fmul in SimplifyDemandedFPClass (PR #173872)

Yingwei Zheng via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Thu Jan 1 12:02:46 PST 2026


================
@@ -5673,12 +5673,24 @@ void computeKnownFPClass(const Value *V, const APInt &DemandedElts,
     break;
   }
   case Instruction::FMul: {
+    const Function *F = cast<Instruction>(Op)->getFunction();
+    DenormalMode Mode =
+        F ? F->getDenormalMode(
+                Op->getType()->getScalarType()->getFltSemantics())
+          : DenormalMode::getDynamic();
+
     // X * X is always non-negative or a NaN.
-    if (Op->getOperand(0) == Op->getOperand(1))
-      Known.knownNot(fcNegative);
+    if (Op->getOperand(0) == Op->getOperand(1)) {
----------------
dtcxzyw wrote:

Missing check for `isGuaranteedNotToBeUndef(X)` (It is only required when we add the non-neg constraint)

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


More information about the llvm-branch-commits mailing list