[llvm-branch-commits] [llvm] InstCombine: Handle fpext in SimplifyDemandedFPClass (PR #174849)

Yingwei Zheng via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Sat Jan 10 04:40:59 PST 2026


================
@@ -2241,6 +2241,28 @@ Value *InstCombinerImpl::SimplifyDemandedUseFPClass(Value *V,
     FPClassTest ValidResults = DemandedMask & Known.KnownFPClasses;
     return getFPClassConstant(VTy, ValidResults, /*IsCanonicalizing=*/true);
   }
+  case Instruction::FPExt: {
+    FPClassTest SrcDemandedMask = DemandedMask;
+
+    // No subnormal result does not imply not-subnormal in the source type.
+    if ((DemandedMask & fcNegSubnormal) == fcNone)
----------------
dtcxzyw wrote:

It is equivalent to `SrcDemandedMask = DemandedMask | fcSubnormal;`. if ((DemandedMask & fcNegNormal) != fcNone) SrcDemandedMask |= fcNegSubnormal; should give a more precise result.

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


More information about the llvm-branch-commits mailing list