[llvm-branch-commits] [llvm] InstCombine: Handle fmul in SimplifyDemandedFPClass (PR #173872)
Matt Arsenault via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Sun Jan 4 09:05:43 PST 2026
================
@@ -2280,6 +2290,127 @@ Value *InstCombinerImpl::SimplifyDemandedUseFPClass(Value *V,
Known = KnownLHS | KnownRHS;
break;
}
+ case Instruction::FMul: {
+ KnownFPClass KnownLHS, KnownRHS;
+
+ Value *X = I->getOperand(0);
+ Value *Y = I->getOperand(1);
+
+ FPClassTest SrcDemandedMask =
+ DemandedMask & (fcNan | fcZero | fcSubnormal | fcNormal);
+
+ if (DemandedMask & fcInf) {
+ // mul x, inf = inf
+ // mul large_x, large_y = inf
+ SrcDemandedMask |= fcSubnormal | fcNormal | fcInf;
+ }
+
+ if (DemandedMask & fcNan) {
+ // mul +/-inf, 0 => nan
+ SrcDemandedMask |= fcZero | fcInf;
+
+ // TODO: Mode check
+ // mul +/-inf, sub => nan if daz
+ SrcDemandedMask |= fcSubnormal;
+ }
+
+ if (X == Y) {
+ if (SimplifyDemandedFPClass(I, 0, SrcDemandedMask, KnownLHS, Depth + 1))
+ return I;
----------------
arsenm wrote:
I think this is kind of broken. It works out in these tests since the only select simplifications performed can support multiple uses. Really this needs to be broken up into single and multiple use versions like SimpilfyDemandedBits is
https://github.com/llvm/llvm-project/pull/173872
More information about the llvm-branch-commits
mailing list