[NFC] Convert OptimizationRemarkEmitter old emit() calls to new closure
parameterized emit() calls

Summary: This is not functional change to adopt new emit() API added in r313691.

Reviewed By: anemet

Subscribers: llvm-commits

Differential Revision: https://reviews.llvm.org/D38285

llvm-svn: 315476
diff --git a/llvm/lib/Transforms/Scalar/TailRecursionElimination.cpp b/llvm/lib/Transforms/Scalar/TailRecursionElimination.cpp
index 62fb552..2376867 100644
--- a/llvm/lib/Transforms/Scalar/TailRecursionElimination.cpp
+++ b/llvm/lib/Transforms/Scalar/TailRecursionElimination.cpp
@@ -255,8 +255,10 @@
         }
         if (SafeToTail) {
           using namespace ore;
-          ORE->emit(OptimizationRemark(DEBUG_TYPE, "tailcall-readnone", CI)
-                    << "marked as tail call candidate (readnone)");
+          ORE->emit([&]() {
+            return OptimizationRemark(DEBUG_TYPE, "tailcall-readnone", CI)
+                   << "marked as tail call candidate (readnone)";
+          });
           CI->setTailCall();
           Modified = true;
           continue;
@@ -301,8 +303,10 @@
     if (Visited[CI->getParent()] != ESCAPED) {
       // If the escape point was part way through the block, calls after the
       // escape point wouldn't have been put into DeferredTails.
-      ORE->emit(OptimizationRemark(DEBUG_TYPE, "tailcall", CI)
-                << "marked as tail call candidate");
+      ORE->emit([&]() {
+        return OptimizationRemark(DEBUG_TYPE, "tailcall", CI)
+               << "marked as tail call candidate";
+      });
       CI->setTailCall();
       Modified = true;
     } else {
@@ -554,8 +558,10 @@
   Function *F = BB->getParent();
 
   using namespace ore;
-  ORE->emit(OptimizationRemark(DEBUG_TYPE, "tailcall-recursion", CI)
-            << "transforming tail recursion into loop");
+  ORE->emit([&]() {
+    return OptimizationRemark(DEBUG_TYPE, "tailcall-recursion", CI)
+           << "transforming tail recursion into loop";
+  });
 
   // OK! We can transform this tail call.  If this is the first one found,
   // create the new entry block, allowing us to branch back to the old entry.