[llvm] [InstCombine] Fold tan(x) * cos(x) => sin(x) (PR #136319)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 23 13:50:00 PDT 2025


================
@@ -947,6 +947,14 @@ Instruction *InstCombinerImpl::foldFMulReassoc(BinaryOperator &I) {
     return BinaryOperator::CreateFMulFMF(XX, Y, &I);
   }
 
+  // tan(X) * cos(X) -> sin(X)
+  if (match(&I,
----------------
arsenm wrote:

In the backend we have some x / sqrt -> rsqrt contractions I wrote, I'd have to look at what other call optimizers are doing 

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


More information about the llvm-commits mailing list