Skip to content

Commit b4d4146

Browse files
committed
[WholeProgramDevirt] Use llvm:: qualifier to implement declared functions. NFC
1 parent 7d9039e commit b4d4146

File tree

1 file changed

+9
-13
lines changed

1 file changed

+9
-13
lines changed

llvm/lib/Transforms/IPO/WholeProgramDevirt.cpp

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -369,16 +369,14 @@ template <> struct DenseMapInfo<VTableSlotSummary> {
369369

370370
} // end namespace llvm
371371

372-
namespace {
373-
374372
// Returns true if the function must be unreachable based on ValueInfo.
375373
//
376374
// In particular, identifies a function as unreachable in the following
377375
// conditions
378376
// 1) All summaries are live.
379377
// 2) All function summaries indicate it's unreachable
380378
// 3) There is no non-function with the same GUID (which is rare)
381-
bool mustBeUnreachableFunction(ValueInfo TheFnVI) {
379+
static bool mustBeUnreachableFunction(ValueInfo TheFnVI) {
382380
if ((!TheFnVI) || TheFnVI.getSummaryList().empty()) {
383381
// Returns false if ValueInfo is absent, or the summary list is empty
384382
// (e.g., function declarations).
@@ -403,6 +401,7 @@ bool mustBeUnreachableFunction(ValueInfo TheFnVI) {
403401
return true;
404402
}
405403

404+
namespace {
406405
// A virtual call site. VTable is the loaded virtual table pointer, and CS is
407406
// the indirect virtual call.
408407
struct VirtualCallSite {
@@ -776,18 +775,17 @@ PreservedAnalyses WholeProgramDevirtPass::run(Module &M,
776775
return PreservedAnalyses::none();
777776
}
778777

779-
namespace llvm {
780778
// Enable whole program visibility if enabled by client (e.g. linker) or
781779
// internal option, and not force disabled.
782-
bool hasWholeProgramVisibility(bool WholeProgramVisibilityEnabledInLTO) {
780+
bool llvm::hasWholeProgramVisibility(bool WholeProgramVisibilityEnabledInLTO) {
783781
return (WholeProgramVisibilityEnabledInLTO || WholeProgramVisibility) &&
784782
!DisableWholeProgramVisibility;
785783
}
786784

787785
/// If whole program visibility asserted, then upgrade all public vcall
788786
/// visibility metadata on vtable definitions to linkage unit visibility in
789787
/// Module IR (for regular or hybrid LTO).
790-
void updateVCallVisibilityInModule(
788+
void llvm::updateVCallVisibilityInModule(
791789
Module &M, bool WholeProgramVisibilityEnabledInLTO,
792790
const DenseSet<GlobalValue::GUID> &DynamicExportSymbols) {
793791
if (!hasWholeProgramVisibility(WholeProgramVisibilityEnabledInLTO))
@@ -805,8 +803,8 @@ void updateVCallVisibilityInModule(
805803
}
806804
}
807805

808-
void updatePublicTypeTestCalls(Module &M,
809-
bool WholeProgramVisibilityEnabledInLTO) {
806+
void llvm::updatePublicTypeTestCalls(Module &M,
807+
bool WholeProgramVisibilityEnabledInLTO) {
810808
Function *PublicTypeTestFunc =
811809
M.getFunction(Intrinsic::getName(Intrinsic::public_type_test));
812810
if (!PublicTypeTestFunc)
@@ -835,7 +833,7 @@ void updatePublicTypeTestCalls(Module &M,
835833
/// If whole program visibility asserted, then upgrade all public vcall
836834
/// visibility metadata on vtable definition summaries to linkage unit
837835
/// visibility in Module summary index (for ThinLTO).
838-
void updateVCallVisibilityInIndex(
836+
void llvm::updateVCallVisibilityInIndex(
839837
ModuleSummaryIndex &Index, bool WholeProgramVisibilityEnabledInLTO,
840838
const DenseSet<GlobalValue::GUID> &DynamicExportSymbols) {
841839
if (!hasWholeProgramVisibility(WholeProgramVisibilityEnabledInLTO))
@@ -855,13 +853,13 @@ void updateVCallVisibilityInIndex(
855853
}
856854
}
857855

858-
void runWholeProgramDevirtOnIndex(
856+
void llvm::runWholeProgramDevirtOnIndex(
859857
ModuleSummaryIndex &Summary, std::set<GlobalValue::GUID> &ExportedGUIDs,
860858
std::map<ValueInfo, std::vector<VTableSlotSummary>> &LocalWPDTargetsMap) {
861859
DevirtIndex(Summary, ExportedGUIDs, LocalWPDTargetsMap).run();
862860
}
863861

864-
void updateIndexWPDForExports(
862+
void llvm::updateIndexWPDForExports(
865863
ModuleSummaryIndex &Summary,
866864
function_ref<bool(StringRef, ValueInfo)> isExported,
867865
std::map<ValueInfo, std::vector<VTableSlotSummary>> &LocalWPDTargetsMap) {
@@ -887,8 +885,6 @@ void updateIndexWPDForExports(
887885
}
888886
}
889887

890-
} // end namespace llvm
891-
892888
static Error checkCombinedSummaryForTesting(ModuleSummaryIndex *Summary) {
893889
// Check that summary index contains regular LTO module when performing
894890
// export to prevent occasional use of index from pure ThinLTO compilation

0 commit comments

Comments
 (0)