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

Hadong Lee via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 20 06:21:17 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.
----------------
ChrisLee02 wrote:

https://github.com/llvm/llvm-project/commit/844a710e8806c438afee90315a685d16ee351d3c

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


More information about the llvm-commits mailing list