Details
- Reviewers
asbirlea mtrofin ychen - Commits
- rG9779b664b6a8: [docs][NewPM] Add section on analyses
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
llvm/docs/NewPassManager.rst | ||
---|---|---|
147 | So does the LPM. We could say "similar to the legacy pass manager, the new pass manager has...". I'd add "there are differences, though, in how passes communicate to the infrastructure to ensure the validity of the cached values" | |
199 | I'd stress here that this must be used when deleting the IR, explicitly, by the pass - and show the code example. I'd also stress that if passes don't do that, the risk is that the same key (==obj pointer) may be used for newly allocated IR and the stale cached value may appear valid when it's not. | |
239 | but for simple cases that's not necessary, the default impl does that, no? | |
293 | I'd recommend adding a subsection with guidelines for analysis authors, and one for consumers of analyses (i.e. pass authors), distilling the design into actionable DO/DON'T statements. Like "don't implement invalidate() and return false, unless you really mean to develop an immutable analysis*) *assuming we fix the issues of bulk-invalidation by the likes of cgscc AM, but I digress :) |
llvm/docs/NewPassManager.rst | ||
---|---|---|
147 | I'm not explicitly trying to compare the new PM to the legacy PM in this doc. The couple points in this doc about the legacy PM are either about removing it in the future, or quick API differences for people who don't want to learn about the new PM in detail and just want to port things quickly | |
239 | There's no default implementation? | |
293 | good point, this is mixing users and implementors of analyses, I'll try to make the distinction better |
llvm/docs/NewPassManager.rst | ||
---|---|---|
239 | See PassManagerInternal.h:172 - there's a wrapper to the analysis result concept. Result::invalidate doesn't need to be implemented unless it does something non-trivial. |
Thanks for writing this up. It is very helpful. Some comments inline.
llvm/docs/NewPassManager.rst | ||
---|---|---|
243 | It would be great to mention that we only do this for inner proxy and in the condition that it matters for performance. In other cases, users should stick with retuned PreservedAnalyses. | |
259 | How about calling it Dependent analysis Invalidation or Analysis Invalidation Propagation or something similar? I think that's the motivation for PassResult::invalidate. Personally Analysis Invalidation reminds me of the returned PreservedAnalyses which is related but not exactly the same thing. |
llvm/docs/NewPassManager.rst | ||
---|---|---|
259 | Implementing Analysis Invalidation? |
llvm/docs/NewPassManager.rst | ||
---|---|---|
161 | s/peer/peek | |
165 | s/a outer/an outer | |
184 | I'd also stress that in the current design, outer analyses are not invalidated until all the passes at that IR level are completed. So using an outer analysis that is not immutable leaves the door open for using incorrect or incomplete analyses. The work around for this is what we do between the Function and Loop IR unit levels with LoopAnalysisResults, where analyses are Function level but used and *updated* by all the Loop passes in the respective LoopPassManager. These are a limited set of trusted analyses and by contract the loop passes will preserve all. This approach makes it harder to "get things wrong" by preventing passes to retrieve arbitrary outer analysis. They can still do it, but they'll need to jump through some hoops to respect the "preserve" contract. | |
318 | s/when we invalidating/when we invalidate |
Thank you writing this, well written and useful doc.
No more big comments from my side, please wait to see if the others have additional comments.
llvm/docs/NewPassManager.rst | ||
---|---|---|
202 | s/updated/updated in |
llvm/docs/NewPassManager.rst | ||
---|---|---|
152 | s/does/has |
llvm/docs/NewPassManager.rst | ||
---|---|---|
152 | thanks, fixed in 0172b1389ecfef2140d459db68f564125d5d41b6 |
So does the LPM. We could say "similar to the legacy pass manager, the new pass manager has...". I'd add "there are differences, though, in how passes communicate to the infrastructure to ensure the validity of the cached values"