[PATCH] D41286: [InstCombine] Missed optimization in math expression: sin(x) / cos(x) => tan(x)

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 8 08:05:40 PST 2018


spatel added inline comments.


================
Comment at: lib/Transforms/InstCombine/InstCombineMulDivRem.cpp:1472
 
+  // sin(a) / cos(a) -> tan(a)
+  if (AllowReassociate) {
----------------
Should we also handle:
  cos(a) / sin(a) -> 1 / tan(a)
?


================
Comment at: test/Transforms/InstCombine/fdiv.ll:161-163
+declare double @tan(double)
+declare float @tanf(float)
+declare fp128 @tanl(fp128)
----------------
Do we need to declare tan functions for these tests?


https://reviews.llvm.org/D41286





More information about the llvm-commits mailing list