This is an archive of the discontinued LLVM Phabricator instance.

[ThinLTO] Promotion handling cleanup (NFC)
ClosedPublic

Authored by tejohnson on Nov 15 2019, 10:57 AM.

Details

Summary

Clean up the code that does GV promotion in the ThinLTO backends.

Specifically, we don't need to check whether we are importing since that
is already checked and handled correctly in shouldPromoteLocalToGlobal.
Simply call shouldPromoteLocalToGlobal, and if it returns true we are
guaranteed that we are promoting, whether or not we are importing (or in
the exporting module). This also makes the handling in getName()
consistent with that in getLinkage(), which checks the DoPromote parameter
regardless of whether we are importing or exporting.

Diff Detail

Event Timeline

tejohnson created this revision.Nov 15 2019, 10:57 AM
evgeny777 added inline comments.Nov 18 2019, 12:05 AM
llvm/lib/Transforms/Utils/FunctionImportUtils.cpp
271–274

Can getName() be now called with false as second argument? If not may be simplify it as well?

tejohnson marked an inline comment as done.Nov 18 2019, 7:31 AM
tejohnson added inline comments.
llvm/lib/Transforms/Utils/FunctionImportUtils.cpp
271–274

Good idea. I cleaned it up to assert that it is passed a local, and renamed to getPromotedName to clarify the behavior.

tejohnson updated this revision to Diff 229846.Nov 18 2019, 7:41 AM

Implement reviewer suggestion and more cleanup

This revision is now accepted and ready to land.Nov 18 2019, 9:44 AM
This revision was automatically updated to reflect the committed changes.