[PATCH] D111586: [Inline] Make sure the InlineAdvisor is correctly cleared.

Arthur Eubanks via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 11 17:04:33 PDT 2021


aeubanks added inline comments.


================
Comment at: llvm/include/llvm/Analysis/InlineAdvisor.h:230
     InlineAdvisor *getAdvisor() const { return Advisor.get(); }
     void clear() { Advisor.reset(); }
 
----------------
this seems like it's reimplementing the invalidation.
can we get rid of `clear()` and use
```
bool invalidate(Module &, const PreservedAnalyses &PA,
                                 ModuleAnalysisManager::Invalidator &) {
  // Check whether the analysis has been explicitly invalidated. Otherwise, it's
  // stateless and remains preserved.
  auto PAC = PA.getChecker<InlineAdvisorAnalysis>();
  return !PAC.preservedWhenStateless();
}
```
?


================
Comment at: llvm/lib/Transforms/IPO/Inliner.cpp:1055
+  Inv.abandon<InlineAdvisorAnalysis>();
+  MAM.invalidate(M, Inv);
   // The ModulePassManager has already taken care of invalidating analyses.
----------------
can we
```
auto PA = PreservedAnalyses::all();
PA.abandon<>();
return PA;
```
instead? and add a comment


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D111586



More information about the llvm-commits mailing list