[llvm] [Transforms] Expand optimizeTan to fold more inverse trig pairs (PR #77799)

Joshua Cranmer via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 17 14:21:04 PST 2024


================
@@ -2603,13 +2604,27 @@ Value *LibCallSimplifier::optimizeSqrt(CallInst *CI, IRBuilderBase &B) {
   return copyFlags(*CI, FabsCall);
 }
 
-// TODO: Generalize to handle any trig function and its inverse.
-Value *LibCallSimplifier::optimizeTan(CallInst *CI, IRBuilderBase &B) {
+Value *LibCallSimplifier::optimizeTrigInverionPairs(CallInst *CI,
+                                                    IRBuilderBase &B) {
+  static const std::map<llvm::StringRef, LibFunc> trigInverses = {
----------------
jcranmer-intel wrote:

`llvm::StringSwitch` is also a workable option.

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


More information about the llvm-commits mailing list