[clang] [llvm] [InstCombine] Combine llvm.sin/llvm.cos libcall pairs into llvm.sincos (PR #184760)

Matt Arsenault via cfe-commits cfe-commits at lists.llvm.org
Mon Apr 27 05:47:56 PDT 2026


================
@@ -1881,6 +1881,65 @@ static Instruction *foldNeonShift(IntrinsicInst *II, InstCombinerImpl &IC) {
   return IC.replaceInstUsesWith(*II, Result);
 }
 
+// If II is llvm.sin(x) or llvm.cos(x), and there is a matching
+// llvm.cos(x) or llvm.sin(x) using the same argument, combine them
+// into a single llvm.sincos(x) call. Returns the result for II
+// extracted from sincos, or nullptr if no match is found.
+static Value *foldSinCosToSinCos(IntrinsicInst *II, IRBuilderBase &B,
----------------
arsenm wrote:

```suggestion
static Value *foldSinAndCosToSinCos(IntrinsicInst *II, IRBuilderBase &B,
```

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


More information about the cfe-commits mailing list