[PATCH] D38285: Convert OptimizationRemarkEmitter old emit() calls to new closure parameterized emit() calls

Adam Nemet via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 9 08:54:48 PDT 2017


anemet added a comment.

One more idea for improvement and then this is ready to go.



================
Comment at: lib/Transforms/IPO/Inliner.cpp:935-945
+        if (OIC->isAlways())
+          return OptimizationRemark(DEBUG_TYPE, "AlwaysInline", DLoc, Block)
+                 << NV("Callee", &Callee) << " inlined into "
+                 << NV("Caller", &F) << " with cost=always";
+        else
+          return OptimizationRemark(DEBUG_TYPE, "Inlined", DLoc, Block)
                  << NV("Callee", &Callee) << " inlined into "
----------------
Can you actually factor this a bit further so that the common parts are done unconditionally.  The reason why we use an insertion operator so that we can do such things.


================
Comment at: lib/Transforms/IPO/SampleProfile.cpp:532-543
+        if (Discriminator)
+          return OptimizationRemarkAnalysis(DEBUG_TYPE, "AppliedSamples", &Inst)
+                 << "Applied " << ore::NV("NumSamples", *R)
+                 << " samples from profile (offset: "
+                 << ore::NV("LineOffset", LineOffset) << "."
+                 << ore::NV("Discriminator", Discriminator) << ")";
+        else
----------------
Same thing here.  Just build the common object and conditionally insert the discriminator.


https://reviews.llvm.org/D38285





More information about the llvm-commits mailing list