[llvm] [InstCombine] Fold scalbn libcalls to llvm.ldexp (PR #216573)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 18 05:55:48 PDT 2026


================
@@ -4103,6 +4110,14 @@ Value *LibCallSimplifier::optimizeFloatingPointLibCall(CallInst *CI,
   case LibFunc_exp2:
   case LibFunc_exp2f:
     return optimizeExp2(CI, Builder);
+  case LibFunc_scalbn:
+  case LibFunc_scalbnf:
+  case LibFunc_scalbnl:
+    // LLVM floating-point types have radix 2, so scalbn is equivalent to
+    // ldexp. Do not replace a libcall that may set errno.
----------------
arsenm wrote:

The defense would be in case some future target has float = decimal FP or something like that 

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


More information about the llvm-commits mailing list