[llvm] [SimplifyLibCalls] Shrink sin, cos to sinf, cosf when allowed (PR #139082)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Thu May 8 14:48:13 PDT 2025


================
@@ -4136,6 +4136,11 @@ Value *LibCallSimplifier::optimizeCall(CallInst *CI, IRBuilderBase &Builder) {
       return optimizeMemCpy(CI, Builder);
     case Intrinsic::memmove:
       return optimizeMemMove(CI, Builder);
+    case Intrinsic::sin:
+    case Intrinsic::cos:
+      if (UnsafeFPShrink)
+        return optimizeUnaryDoubleFP(CI, Builder, TLI, /*isPrecise=*/true);
----------------
arsenm wrote:

In theory no, the intrinsics should just work and have nothing to with the libcalls. In practice if the intrinsic will lower to a libcall, and it would have worked as double, codegen could promote it 

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


More information about the llvm-commits mailing list