The annotation is gated by a bool option, and off by default.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
This is a strict subset of https://reviews.llvm.org/D125495, to make that patch simpler.
- Fix a bug in InlineAdvisor::getAnnotatedInlinePassName (from https://reviews.llvm.org/D126824). Basically, to compute string only once, make it a constant member of class, and return its c_str() ever since.
- Let SampleProfileLoader class call llvm::AnnotateInlinePassName to get an annotated name.
The patch looks good in general, but I have some nit-picky suggestions.
llvm/include/llvm/Analysis/InlineAdvisor.h | ||
---|---|---|
211 | Capitalize the variable name like AnnotatedInlinePassName. | |
llvm/lib/Analysis/InlineAdvisor.cpp | ||
576–577 | You should be able to remove this if statement. When IC.hasValue() is false, the constructor sets annotatedInlinePassName to DEBUG_TYPE. Once the function has been simplified down to: const char *InlineAdvisor::getAnnotatedInlinePassName() { return annotatedInlinePassName.c_str(); } you might as well move it to InlineAdvisor.h. | |
llvm/lib/Transforms/IPO/SampleProfile.cpp | ||
503 | Capitalize the variable name like AnnotatedPassName. | |
545 | Remove inline unless you absolutely need it. | |
598 | Likewise, remove inline unless you absolutely need it. | |
599–602 | Could you fully compute annotatedPassName in the constructor as you do in InlineAdvisor.cpp? I'm suggesting this partly for consistency with InlineAdvisor.cpp and partly for readability. Again, you might consider moving the function to the class declaration. |
thanks for reviews! PTAL.
llvm/lib/Analysis/InlineAdvisor.cpp | ||
---|---|---|
576–577 | Done by 1) simplifying InlineAdvisor::getAnnotatedInlinePassName 2) move it to InlineAdvisor.h. |
Address comments, by using overloaded operator rather than hasValue() / getValue(), since the former is closer to std::optional in terms of style.
Capitalize the variable name like AnnotatedInlinePassName.