This is an archive of the discontinued LLVM Phabricator instance.

[FuncSpec] Statistics
ClosedPublic

Authored by SjoerdMeijer on Jun 11 2021, 3:20 AM.

Details

Summary

Adds some bookkeeping for collecting the number of specialised functions, and a test.

Diff Detail

Event Timeline

SjoerdMeijer created this revision.Jun 11 2021, 3:20 AM
SjoerdMeijer requested review of this revision.Jun 11 2021, 3:20 AM
Herald added a project: Restricted Project. · View Herald TranscriptJun 11 2021, 3:20 AM

This is sort of a placeholder for follow up comments of D93838 while I am looking into a few things.

llvm/lib/Transforms/IPO/FunctionSpecialization.cpp
67

I did change something here; partly addressed this, but need to remind myself what that was. Will look into this.

SjoerdMeijer added inline comments.Jun 11 2021, 3:26 AM
llvm/lib/Transforms/IPO/FunctionSpecialization.cpp
466

Looks like this is not covered by a test. Would be good to have one.

Will look into that.

The wrong location didn't sit right, so I have precommitted that in rG9907746f5db7 before I continue with the rest and this is a little rebase on top of that.

Matt added a subscriber: Matt.Jun 11 2021, 10:08 AM
ormris removed a subscriber: ormris.Jun 11 2021, 2:49 PM
fhahn added a comment.Jun 14 2021, 7:38 AM

Thanks for the update! Could you update the description/title, as they seem a bit out-of-sync after the recent changes.

llvm/lib/Transforms/IPO/FunctionSpecialization.cpp
124

might be good to also have a test to check the stats work as expected?

146

Would be good to add a comment. Should the type be unsigned?

It looks like this patch is tried to refactor the counter? What's the difference after applying this patch? Or is it a NFC patch?

Thanks for your comments. I quickly put this patch together to collect post-commit comments. I will pick this is up today.

Thanks for your comments. I quickly put this patch together to collect post-commit comments. I will pick this is up today.

Oh, so it is a WIP patch which containing changes in different aspects? I am not sure if it is better to separate them. I guess it would be better to review and revert (if needed).

SjoerdMeijer retitled this revision from Function Specialisation, cont'd to [FuncSpec] Statistics.
SjoerdMeijer edited the summary of this revision. (Show Details)

This is now only about statistics: commented/renamed the counter, and added a test case.

This revision is now accepted and ready to land.Jun 15 2021, 1:07 AM
fhahn added inline comments.Jun 15 2021, 1:14 AM
llvm/test/Transforms/FunctionSpecialization/function-specialization-stats.ll
3 ↗(On Diff #352055)

do we need to run those unrelated passes?

SjoerdMeijer added inline comments.Jun 15 2021, 2:00 AM
llvm/test/Transforms/FunctionSpecialization/function-specialization-stats.ll
3 ↗(On Diff #352055)

Not necessarily, but it kind of nicely illustrates the possibilities with those "clean up" passes, the things function specialisation enables.

Let me know what you prefer as I am of course happy to remove them.

This revision was automatically updated to reflect the committed changes.
fhahn added inline comments.Jun 16 2021, 1:41 AM
llvm/test/Transforms/FunctionSpecialization/function-specialization-stats.ll
3 ↗(On Diff #352055)

Not necessarily, but it kind of nicely illustrates the possibilities with those "clean up" passes, the things function specialisation enables.

Let me know what you prefer as I am of course happy to remove them.

Usually we try to avoid having tests depend on different passes, to reduce churn when making changes to unrelated passes. While it is nice other stats improve, it’s independent of checking the function specialisation stats.

SjoerdMeijer added inline comments.Jun 16 2021, 2:19 AM
llvm/lib/Transforms/IPO/FunctionSpecialization.cpp
466

Added a test for that in rG29843cbc88f6.

llvm/test/Transforms/FunctionSpecialization/function-specialization-stats.ll
3 ↗(On Diff #352055)

Ok, sure, understood. This is indeed almost an end-to-end test for function specialisation, and it would be good to have that, but it does not necessarily fit here. Will modify this test.