[PATCH] D58399: [Inliner] Don't initialize ComputeFullInlineCost to be always true because of ORE

Wei Mi via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 19 15:22:14 PST 2019


wmi updated this revision to Diff 187456.
wmi added a comment.

Address Easwaran and Chandler's comments.


Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D58399/new/

https://reviews.llvm.org/D58399

Files:
  lib/Analysis/InlineCost.cpp
  lib/Transforms/IPO/Inliner.cpp
  lib/Transforms/IPO/PartialInlining.cpp


Index: lib/Transforms/IPO/PartialInlining.cpp
===================================================================
--- lib/Transforms/IPO/PartialInlining.cpp
+++ lib/Transforms/IPO/PartialInlining.cpp
@@ -762,8 +762,12 @@
 
   Function *Caller = CS.getCaller();
   auto &CalleeTTI = (*GetTTI)(*Callee);
-  InlineCost IC = getInlineCost(CS, getInlineParams(), CalleeTTI,
-                                *GetAssumptionCache, GetBFI, PSI, &ORE);
+  bool RemarksEnabled =
+      Callee->getContext().getDiagHandlerPtr()->isMissedOptRemarkEnabled(
+          DEBUG_TYPE);
+  InlineCost IC =
+      getInlineCost(CS, getInlineParams(), CalleeTTI, *GetAssumptionCache,
+                    GetBFI, PSI, RemarksEnabled ? &ORE : nullptr);
 
   if (IC.isAlways()) {
     ORE.emit([&]() {
Index: lib/Transforms/IPO/Inliner.cpp
===================================================================
--- lib/Transforms/IPO/Inliner.cpp
+++ lib/Transforms/IPO/Inliner.cpp
@@ -1005,8 +1005,11 @@
     auto GetInlineCost = [&](CallSite CS) {
       Function &Callee = *CS.getCalledFunction();
       auto &CalleeTTI = FAM.getResult<TargetIRAnalysis>(Callee);
+      bool RemarksEnabled =
+          Callee.getContext().getDiagHandlerPtr()->isMissedOptRemarkEnabled(
+              DEBUG_TYPE);
       return getInlineCost(CS, Params, CalleeTTI, GetAssumptionCache, {GetBFI},
-                           PSI, &ORE);
+                           PSI, RemarksEnabled ? &ORE : nullptr);
     };
 
     // Now process as many calls as we have within this caller in the sequnece.
Index: lib/Analysis/InlineCost.cpp
===================================================================
--- lib/Analysis/InlineCost.cpp
+++ lib/Analysis/InlineCost.cpp
@@ -2005,6 +2005,12 @@
   if (!Callee)
     return llvm::InlineCost::getNever("indirect call");
 
+  OptimizationRemarkEmitter NewORE(Callee);
+  if (!ORE &&
+      Callee->getContext().getDiagHandlerPtr()->isMissedOptRemarkEnabled(
+          DEBUG_TYPE))
+    ORE = &NewORE;
+
   // Never inline calls with byval arguments that does not have the alloca
   // address space. Since byval arguments can be replaced with a copy to an
   // alloca, the inlined code would need to be adjusted to handle that the


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D58399.187456.patch
Type: text/x-patch
Size: 2228 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190219/e1a254ff/attachment.bin>


More information about the llvm-commits mailing list