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

Eli Friedman via llvm-commits llvm-commits at lists.llvm.org
Thu May 8 14:09: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);
----------------
efriedma-quic wrote:

The other calls to optimizeUnaryDoubleFP have some kind of check to see if the "f" version exists.  Do we also need something here?

(Not that there's really a good way to do that check at the moment, but see LibCallSimplifier::optimizeSqrt.)

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


More information about the llvm-commits mailing list