[ThinLTO] Promotion handling cleanup (NFC)
authorTeresa Johnson <tejohnson@google.com>
Mon, 18 Nov 2019 15:05:05 +0000 (07:05 -0800)
committerTeresa Johnson <tejohnson@google.com>
Mon, 18 Nov 2019 19:59:36 +0000 (11:59 -0800)
commit3be6dbca3b88e82009e1990957c15b94455c1714
tree74c4c9c363ca25ce8a2337b96109366da6d24bf3
parentff75bf6ac93a9ef5a7d41f7645e02fde3e968ce1
[ThinLTO] Promotion handling cleanup (NFC)

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.

Reviewers: steven_wu, pcc, evgeny777

Subscribers: mehdi_amini, inglorion, hiraditya, dexonsmith, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D70327
llvm/include/llvm/Transforms/Utils/FunctionImportUtils.h
llvm/lib/Transforms/Utils/FunctionImportUtils.cpp