In LTO or Thin-lto mode (though linker plugin), the module names are of temp file names which are different for different complations. Using SourceFileName avoids the issue.
This should not change any functionality for current PGO as all the current callers of getPGOFuncName() is before LTO.
Details
- Reviewers
davidxl kristina - Commits
- rG016220549dd7: [PGO] Use SourceFileName rather module name in PGOFuncName
rL350671: [PGO] Use SourceFileName rather module name in PGOFuncName
rL350442: [PGO] Use SourceFileName rather module name in PGOFuncName
rL350579: [PGO] Use SourceFileName rather module name in PGOFuncName
Diff Detail
Event Timeline
lib/ProfileData/InstrProf.cpp | ||
---|---|---|
255 | When StaticFullModulePrefix is false, should the base name be used ? |
lib/ProfileData/InstrProf.cpp | ||
---|---|---|
255 | Yes. when it's false, only use the basename. There is a test |
lib/ProfileData/InstrProf.cpp | ||
---|---|---|
255 | but the stripLevel will be reset to StaticFuncStripDirNamePrefix which is 0 by default? |
lib/ProfileData/InstrProf.cpp | ||
---|---|---|
255 | It will not be reset as the cond in line 257 will be false if StripLevel is (unsigned) -1. |
lgtm
lib/ProfileData/InstrProf.cpp | ||
---|---|---|
255 | ok, please put an explicit type casting before '-1' to make it clearer. |
I feel like this needs a test or amending an existing test, a bit too tired right now to patch this into my fork and run the test suite, but I feel as-is, this could cause test failures (and if it doesn't, that's likely indicative of missing coverage). Please address that before committing it. Also, see inline comments, first one is a style nit but I'm more concerned about uint32_t StripLevel = StaticFuncFullModulePrefix ? 0 : -1;.
lib/ProfileData/InstrProf.cpp | ||
---|---|---|
255 | What's the rationale behind changing the way FileName is constructed? I don't think there's a reason to change this from an assign-constructor (it's not consistent with surrounding code and even rest of the patch). | |
256 | I'm not exactly sure what is happening here. Why are you storing a signed value in an unsigned type? In addition, what's the rationale behind using an stdint type here? A simple int should suffice. |
lib/ProfileData/InstrProf.cpp | ||
---|---|---|
255 | it's to set to the largest int. In the committed version, there is an explicit conversion. | |
255 | As I mentioned in the initial reviews, using source filename makes more sense than using module name. |
Differential Review is mostly for pre-commit review, add in "Differential Revision: https://reviews.llvm.org/DXXXXX" to the commit message and it will automatically link the commit and diff and close it. As an alternative you can do that manually, It seems bigger patch has already been committed in rL350579 (without review) and this was pending review rL350442. I've linked those in but if you say it's been fixed in the committed version and this is a followup, can you rebase the patch on the current trunk? For post-commit reviews Audit may be a better place if you need that.
@xur - something weird happened with your commits. The one mentioned by @kristina above (r350579) was actually D56342 ([llvm-profdata] add value-cutoff functionality to show command) which was reviewed, but somehow got the same title and commit message as this patch. Not sure if there is a way to go back and fix that in the commit log...if not I'd recommend reverting it and recommitting with the correct commit log and title.
Also, as @kristina mentions, if your commit log contains a message like "Differential Revision: https://reviews.llvm.org/DXXXXX" it would link to the patch on phab.
and this was pending review rL350442. I've linked those in but if you say it's been fixed in the committed version and this is a followup, can you rebase the patch on the current trunk? For post-commit reviews Audit may be a better place if you need that.
Beyond the weird commit message issue, there are also comments on this revision. They arrived after it was landed in the tree, so its more like post-commit review, but the comments should still be addressed or responded to here.
@kristina: This patch does not functionally change anything in current code base. We think this patch makes more sense than the original one (which also contributed by us)
Current code works fine (as all the callers to getPGOFuncName() are before LTO). Tests for stripping behavior is already in the test suite.
It will break once that functions is called in LTO or after LTO with unknown function error. This will show in patch here https://reviews.llvm.org/D54175.
I cannot write a new test for this as there is currently no caller from LTO or passes after LTO.
If I cannot land this patch alone, I have to move it to D54175.
When StaticFullModulePrefix is false, should the base name be used ?