[llvm-branch-commits] [llvm] InstCombine: Handle fadd in SimplifyDemandedFPClass (PR #174853)

Yingwei Zheng via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Sat Jan 10 06:05:18 PST 2026


================
@@ -2091,6 +2110,86 @@ Value *InstCombinerImpl::SimplifyDemandedUseFPClass(Value *V,
     Known.fneg();
     break;
   }
+  case Instruction::FAdd: {
+    KnownFPClass KnownLHS, KnownRHS;
+
+    const SimplifyQuery &SQ = getSimplifyQuery();
+
+    // fadd x, x can be handled more aggressively.
+    if (I->getOperand(0) == I->getOperand(1) &&
+        isGuaranteedNotToBeUndef(I->getOperand(0), SQ.AC, CxtI, SQ.DT,
+                                 Depth + 1)) {
+      FPClassTest SrcDemandedMask = DemandedMask;
+
+      // Doubling a subnormal could have resulted in a normal value.
----------------
dtcxzyw wrote:

Doubling a subnormal may produce zero.

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


More information about the llvm-branch-commits mailing list