-
Notifications
You must be signed in to change notification settings - Fork 17.1k
[AsmPrinter] Reduce AsmPrinterHandlers virt. fn calls #96785
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -382,13 +382,10 @@ class AsmPrinterHandlerTest : public AsmPrinterFixtureBase { | |
| public: | ||
| TestHandler(AsmPrinterHandlerTest &Test) : Test(Test) {} | ||
| virtual ~TestHandler() {} | ||
| virtual void setSymbolSize(const MCSymbol *Sym, uint64_t Size) override {} | ||
| virtual void beginModule(Module *M) override { Test.BeginCount++; } | ||
| virtual void endModule() override { Test.EndCount++; } | ||
| virtual void beginFunction(const MachineFunction *MF) override {} | ||
| virtual void endFunction(const MachineFunction *MF) override {} | ||
| virtual void beginInstruction(const MachineInstr *MI) override {} | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks @MaskRay. I am concerned that this is removing this particular API that is used by Julia to add a new DebugHandler. I am a mild NAK on doing so merely in the interest in reducing the internal instruction counter metric when it seems that you reported it doesn't actually improve performance. Refactoring is fine, and I don't mind if we need to change names of the API and such, as long as the functionality remains accessible to add beginInstruction hooks.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For this purpose, I already added
That's one way to phrase it -- improving performance of every single compilation done by LLVM would be mine. 🤷
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Instruction count may only have a weak correlation with wall time though, since instructions take vastly different times to retire, while your comment above seemed to show that this PR made everything measured at 0.5% slower (#96785 (comment)) if I am reading that right. I assume that is well within the noise factor, so not a blocker from me.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
I know and also do time measurements locally. Indirect function calls are frequently less efficient than, e.g., arithmetic instructions.
Good, thanks for checking! I'll add a test case.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I added a test for addDebugHandler. If Julia's use case turns out to have significant problems after merging this, we can still adjust DebugHandlerBase afterwards to be more flexible. |
||
| virtual void endInstruction() override {} | ||
| }; | ||
|
|
||
| protected: | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Personal note:
HandlerInfowas made public by https://reviews.llvm.org/D74158 due to Julia's use. @vtjnashThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point, I added an addDebugHandler method so that the Julia use case should continue to work.