-
Notifications
You must be signed in to change notification settings - Fork 15.2k
[WPD][ThinLTO]Add cutoff option for WPD #113383
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 |
|---|---|---|
|
|
@@ -168,6 +168,14 @@ static cl::list<std::string> | |
| cl::desc("Prevent function(s) from being devirtualized"), | ||
| cl::Hidden, cl::CommaSeparated); | ||
|
|
||
| /// If this value is other than 0, the devirt module pass will stop | ||
| /// transformation once the total number of devirtualizations reach the cutoff | ||
| /// value. | ||
| static cl::opt<unsigned> WholeProgramDevirtCutoff( | ||
| "wholeprogramdevirt-cutoff", | ||
| cl::desc("Max number of devirtualization for devirt module pass"), | ||
|
||
| cl::init(0)); | ||
|
|
||
| /// Mechanism to add runtime checking of devirtualization decisions, optionally | ||
| /// trapping or falling back to indirect call on any that are not correct. | ||
| /// Trapping mode is useful for debugging undefined behavior leading to failures | ||
|
|
@@ -1169,6 +1177,10 @@ void DevirtModule::applySingleImplDevirt(VTableSlotInfo &SlotInfo, | |
| if (!OptimizedCalls.insert(&VCallSite.CB).second) | ||
| continue; | ||
|
|
||
| if (WholeProgramDevirtCutoff.getNumOccurrences() > 0 && | ||
| NumSingleImpl >= WholeProgramDevirtCutoff) | ||
|
||
| return; | ||
|
|
||
| if (RemarksEnabled) | ||
| VCallSite.emitRemark("single-impl", | ||
| TheFn->stripPointerCasts()->getName(), OREGetter); | ||
|
|
||
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.
I believe the way the code is written, value 0 is not special and will cause no devirts to happen - assuming the option was specified (i.e. getNumOccurrences() > 0). And in fact we probably want a way to say "do 0 devirtualizations".
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.
I updated the comment, and yes it makes sense to do 0 devirtualization when this option is explicitly set to zero.