mtrofin added a comment.

I think InlineAdvisor::getAdvice needs to take a bool MandatoryOnly, which 
Inliner then passes. This allows us to then use the same advisor for both the 
always case and the policy-driven inliner instances, which allows that advisor 
to correctly book-keep any module wide state it may want to.



================
Comment at: llvm/include/llvm/Transforms/IPO/Inliner.h:111
+  std::unique_ptr<InlineAdvisor> OwnedAdvisor;
+  bool Mandatory;
 };
----------------
Nit: const bool


================
Comment at: llvm/lib/Transforms/IPO/Inliner.cpp:661
                         FunctionAnalysisManager &FAM, Module &M) {
+  if (Mandatory) {
+    OwnedAdvisor = std::make_unique<MandatoryInlineAdvisor>(FAM);
----------------
This should move to line 675: if we have installed an advisor, we use it, and 
the inliner pass passes to getAdvice() whether it only needs mandatory advice. 
All advisors need to support the mandatory case anyway.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D94808

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to