This is an archive of the discontinued LLVM Phabricator instance.

[ThinLTO] Use NoPromote flag in summary during promotion
ClosedPublic

Authored by tejohnson on Oct 27 2016, 8:48 PM.

Details

Summary

Replace the check of whether a GV has a section with the flag check
in the summary. This is in preparation for using the NoPromote flag
to convey other situations when we can't promote (e.g. locals used in
inline asm).

Diff Detail

Repository
rL LLVM

Event Timeline

tejohnson updated this revision to Diff 76163.Oct 27 2016, 8:48 PM
tejohnson retitled this revision from to [ThinLTO] Use NoPromote flag in summary during promotion.
tejohnson updated this object.
tejohnson added a reviewer: mehdi_amini.
tejohnson added a subscriber: llvm-commits.
mehdi_amini added inline comments.Oct 27 2016, 11:27 PM
include/llvm/Transforms/Utils/FunctionImportUtils.h
58 ↗(On Diff #76163)

Update doc.

70 ↗(On Diff #76163)

Ditto.

lib/Transforms/Utils/FunctionImportUtils.cpp
206 ↗(On Diff #76163)

The flow to initialize the "DoPromote" is very difficult to process / follow here. We should seek some refactoring to make it more readable.

tejohnson marked 2 inline comments as done.Oct 28 2016, 5:52 AM
tejohnson added inline comments.
lib/Transforms/Utils/FunctionImportUtils.cpp
206 ↗(On Diff #76163)

I passed in false here directly, since DoPromote would always be false and that will hopefully be clearer.

tejohnson updated this revision to Diff 76180.Oct 28 2016, 5:52 AM

Address review comments

mehdi_amini accepted this revision.Oct 28 2016, 10:11 PM
mehdi_amini edited edge metadata.

LGTM.

include/llvm/Transforms/Utils/FunctionImportUtils.h
44 ↗(On Diff #76180)

The name should be "shouldPromoteLocalToGlobal", the "do" added some cognitive load for me to read this patch (I'm not saying that it should be done as part of this patch, but either before or after would be a nice tweak).

lib/Transforms/Utils/FunctionImportUtils.cpp
70 ↗(On Diff #76180)

This SGV->getGUID() is the cause for the "DoPromote" right?

This revision is now accepted and ready to land.Oct 28 2016, 10:11 PM
tejohnson added inline comments.Oct 29 2016, 2:38 PM
include/llvm/Transforms/Utils/FunctionImportUtils.h
44 ↗(On Diff #76180)

Sure. I have this one ready to go, so will do the rename in an immediately following patch.

lib/Transforms/Utils/FunctionImportUtils.cpp
70 ↗(On Diff #76180)

Right.

This revision was automatically updated to reflect the committed changes.