[llvm] [GlobalISel] Avoid constant folding of different FP types in FCMP (PR #171878)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Fri Dec 12 05:19:15 PST 2025


================
@@ -74,6 +74,9 @@ bool CombinerHelper::constantFoldFCmp(const GFCmp &FCmp,
   APFloat LHS = LHSCst.getScalarValue();
   APFloat RHS = RHSCst.getScalarValue();
 
+  if (&LHS.getSemantics() != &RHS.getSemantics())
+    return false;
----------------
arsenm wrote:

I think this should have been a malformed query. In the testcase, whatever code looked through the chain to find the constant should have interpreted the 64-bit value, with a bitwise truncate and reinterpret in the new semantics 

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


More information about the llvm-commits mailing list