[PATCH] D14302: [SimplifyLibCalls] Add a new transform: tan(atan(x)) -> x

David Majnemer via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 3 14:15:11 PST 2015


majnemer added inline comments.

================
Comment at: lib/Transforms/Utils/SimplifyLibCalls.cpp:1381
@@ +1380,3 @@
+  // tanf(atanf(x)) -> x
+  if (auto *OpC = dyn_cast<CallInst>(Op1)) {
+    IRBuilder<>::FastMathFlagGuard Guard(B);
----------------
I think it would be nicer to do an early return:
  auto *OpC = dyn_cast<CallInst>(Op1);
  if (!OpC)
    return Ret;

================
Comment at: lib/Transforms/Utils/SimplifyLibCalls.cpp:1382
@@ +1381,3 @@
+  if (auto *OpC = dyn_cast<CallInst>(Op1)) {
+    IRBuilder<>::FastMathFlagGuard Guard(B);
+    LibFunc::Func Func;
----------------
Is the guard needed?


http://reviews.llvm.org/D14302





More information about the llvm-commits mailing list