Builds on Preemptable IR patch
Uses the symbol resolutions the linker provides to mark GlobalValues as local. Add a Local flag to the GlobalValue summaries for thinlto.
Details
- Reviewers
pcc tejohnson mehdi_amini ncharlie - Commits
- rG4595a915f6d1: [LTO][ThinLTO] Use the linker resolutions to mark global values as dso_local.
rG36528c2a9b3d: [LTO][ThinLTO] Use the linker resolutions to mark global values as dso_local.
rL317408: [LTO][ThinLTO] Use the linker resolutions to mark global values as dso_local.
rL317374: [LTO][ThinLTO] Use the linker resolutions to mark global values as dso_local.
Diff Detail
- Repository
- rL LLVM
Event Timeline
Thanks, I'm glad to see this coming!
lib/LTO/LTO.cpp | ||
---|---|---|
691 ↗ | (On Diff #107501) | This does not seem safe in face of hash collision. |
lib/Transforms/Utils/FunctionImportUtils.cpp | ||
223 ↗ | (On Diff #107501) | You have a null check here, while the same iteration in LTO.cpp does not bother. I think we should be able to skip the null check by construction. |
225 ↗ | (On Diff #107501) | This loop is: bool gv_is_dso_local = llvm::any_of(VI.getSummaryList(), [} (const std::unique_ptr<GlobalValueSummary> &Summary) { return Summary->isDSOLocal(); }); if (gv_is_dso_local) GV.setDSOLocal(true); |
228 ↗ | (On Diff #107501) | I was trying to figure out if your code handles declarations as well, and it seems so. |
include/llvm/IR/ModuleSummaryIndex.h | ||
---|---|---|
152 ↗ | (On Diff #107501) | whithin -> within |
lib/Bitcode/Reader/BitcodeReader.cpp | ||
---|---|---|
876 ↗ | (On Diff #107501) | Do we need some version check (and some comments) for compatibility with old bc files? |
lib/Bitcode/Reader/BitcodeReader.cpp | ||
---|---|---|
876 ↗ | (On Diff #107501) | The default will be 0 for old .bc files, which translate to "not local", which should be conservatively OK I believe? Ideally we would checking a bitcode file from the 5.0 branching point in the repo and test this behavior. |
Fixed spelling in comment.
Updated the look-up when marking summary as local to be limited to the bitcode module being added.
Changed for loop to llvm::any_of.
lib/Bitcode/Reader/BitcodeReader.cpp | ||
---|---|---|
876 ↗ | (On Diff #107501) | That was my reasoning for not needing a version check. |
lib/LTO/LTO.cpp | ||
691 ↗ | (On Diff #107501) | I've limited the summary look-up to the bitcode module we are currently adding, is this what you had in mind? |
685 ↗ | (On Diff #108159) | I realize that this is the same GUID as calculated above since the call to getGlobalIdentifier is being passed ExternalLinkage. I'll update this to reflect that. |
re-based, removed accidentally added white space in one of the tests and used the existing GUID in addThinLTO summary look-up.
Rebased to top of trunk. The patch this one is dependent on is now committed as well,
lib/Transforms/Utils/FunctionImportUtils.cpp | ||
---|---|---|
215 ↗ | (On Diff #120934) | I think you need to check that all summaries are dso-local to protect against hash collisions here. |
Changed the importing to check that every summary is local before marking a GlobalValue as local.
lib/Transforms/Utils/FunctionImportUtils.cpp | ||
---|---|---|
215 ↗ | (On Diff #120934) | Good point. Updated. |