This patch is a fix for https://bugs.llvm.org/show_bug.cgi?id=41804.
We try to solve the precedence of user-specified symbol ordering file and C3 ordering provided as call graph. It deals with two case:
(1) When both --symbol-ordering-file=<file> and --call-graph-order-file=<file> are present, whichever flag comes later will take precedence.
(2) When only --symbol-ordering-file=<file> is present, it takes precedence over implicit call graph (CGProfile) generated by CGProfilePass enabled in new pass manager.
Details
- Reviewers
ruiu george.burgess.iv pcc • espindola
Diff Detail
- Repository
- rG LLVM Github Monorepo
- Build Status
Buildable 32038 Build 32037: arc lint + arc unit
Event Timeline
(1) When both --symbol-ordering-file=<file> and --call-graph-order-file=<file> are present, whichever flag comes later will take precedence.
It looks like this combination is a misuse of the feature. Instead of silently ignore a flag, I think we should report an error that these flags cannot be used together.
(2) When only --symbol-ordering-file=<file> is present, it takes precedence over implicit call graph (CGProfile) generated by CGProfilePass enabled in new pass manager.
This is fine by me.
This patch is a fix for https://bugs.llvm.org/show_bug.cgi?id=41804.
We try to solve the precedence of user-specified symbol ordering file and C3 ordering provided as call graph. It deals with two case:
(1) When both --symbol-ordering-file=<file> and --call-graph-order-file=<file> are present, LLD reports an error and aborts.
(2) When only --symbol-ordering-file=<file> is present, it takes precedence over implicit call graph (CGProfile) generated by CGProfilePass enabled in new pass manager.
lld/ELF/Driver.cpp | ||
---|---|---|
968–970 | Check for invalid combination of flags are usually done in checkOptions(). Can you write a check for this combination there? |
lld/ELF/Driver.cpp | ||
---|---|---|
968–970 | checkOptions() function doesn't take any arguments in but I need Args to check if OPT_call_graph_ordering_file is present or not. It's because the flag is read very late in the stage (just before writeResult<ELFT>() ) and not saved to any Config field, I have to use Args to directly check its presence. Whereas in checkOptions(), all other checkings are done by checking Config fields. Also, if I do check in checkOptions(), which happens after readConfigs(), it needs to read in the file even if an error will be reported later? |
lld/ELF/Driver.cpp | ||
---|---|---|
968–970 | OK, but please make the wording consistent with other error messages. If you look at checkOptions, you'd notice that we use the same wording for reporting incompatible option combinations. |
lld/ELF/Driver.cpp | ||
---|---|---|
968–970 | Yeah, that makes sense. Thanks for pointing out. |
The commit description of rLLD361190 does not contain Differential Revision: https://reviews.llvm.org/D61711, so the revision was not closed when you committed that...
Also, the description should probably say the two options are now exclusive:
(1) When both --symbol-ordering-file=<file> and --call-graph-order-file=<file> are present, whichever flag comes later will take precedence.
Thank you! I'll keep in mind to add the differential revision to LLVM commit next time. Also, is it possible to change the commit message on the other commits now? Sorry that I forgot to change them...
Check for invalid combination of flags are usually done in checkOptions(). Can you write a check for this combination there?