@@ -369,16 +369,14 @@ template <> struct DenseMapInfo<VTableSlotSummary> {
369
369
370
370
} // end namespace llvm
371
371
372
- namespace {
373
-
374
372
// Returns true if the function must be unreachable based on ValueInfo.
375
373
//
376
374
// In particular, identifies a function as unreachable in the following
377
375
// conditions
378
376
// 1) All summaries are live.
379
377
// 2) All function summaries indicate it's unreachable
380
378
// 3) There is no non-function with the same GUID (which is rare)
381
- bool mustBeUnreachableFunction (ValueInfo TheFnVI) {
379
+ static bool mustBeUnreachableFunction (ValueInfo TheFnVI) {
382
380
if ((!TheFnVI) || TheFnVI.getSummaryList ().empty ()) {
383
381
// Returns false if ValueInfo is absent, or the summary list is empty
384
382
// (e.g., function declarations).
@@ -403,6 +401,7 @@ bool mustBeUnreachableFunction(ValueInfo TheFnVI) {
403
401
return true ;
404
402
}
405
403
404
+ namespace {
406
405
// A virtual call site. VTable is the loaded virtual table pointer, and CS is
407
406
// the indirect virtual call.
408
407
struct VirtualCallSite {
@@ -776,18 +775,17 @@ PreservedAnalyses WholeProgramDevirtPass::run(Module &M,
776
775
return PreservedAnalyses::none ();
777
776
}
778
777
779
- namespace llvm {
780
778
// Enable whole program visibility if enabled by client (e.g. linker) or
781
779
// internal option, and not force disabled.
782
- bool hasWholeProgramVisibility (bool WholeProgramVisibilityEnabledInLTO) {
780
+ bool llvm:: hasWholeProgramVisibility (bool WholeProgramVisibilityEnabledInLTO) {
783
781
return (WholeProgramVisibilityEnabledInLTO || WholeProgramVisibility) &&
784
782
!DisableWholeProgramVisibility;
785
783
}
786
784
787
785
// / If whole program visibility asserted, then upgrade all public vcall
788
786
// / visibility metadata on vtable definitions to linkage unit visibility in
789
787
// / Module IR (for regular or hybrid LTO).
790
- void updateVCallVisibilityInModule (
788
+ void llvm:: updateVCallVisibilityInModule (
791
789
Module &M, bool WholeProgramVisibilityEnabledInLTO,
792
790
const DenseSet<GlobalValue::GUID> &DynamicExportSymbols) {
793
791
if (!hasWholeProgramVisibility (WholeProgramVisibilityEnabledInLTO))
@@ -805,8 +803,8 @@ void updateVCallVisibilityInModule(
805
803
}
806
804
}
807
805
808
- void updatePublicTypeTestCalls (Module &M,
809
- bool WholeProgramVisibilityEnabledInLTO) {
806
+ void llvm:: updatePublicTypeTestCalls (Module &M,
807
+ bool WholeProgramVisibilityEnabledInLTO) {
810
808
Function *PublicTypeTestFunc =
811
809
M.getFunction (Intrinsic::getName (Intrinsic::public_type_test));
812
810
if (!PublicTypeTestFunc)
@@ -835,7 +833,7 @@ void updatePublicTypeTestCalls(Module &M,
835
833
// / If whole program visibility asserted, then upgrade all public vcall
836
834
// / visibility metadata on vtable definition summaries to linkage unit
837
835
// / visibility in Module summary index (for ThinLTO).
838
- void updateVCallVisibilityInIndex (
836
+ void llvm:: updateVCallVisibilityInIndex (
839
837
ModuleSummaryIndex &Index, bool WholeProgramVisibilityEnabledInLTO,
840
838
const DenseSet<GlobalValue::GUID> &DynamicExportSymbols) {
841
839
if (!hasWholeProgramVisibility (WholeProgramVisibilityEnabledInLTO))
@@ -855,13 +853,13 @@ void updateVCallVisibilityInIndex(
855
853
}
856
854
}
857
855
858
- void runWholeProgramDevirtOnIndex (
856
+ void llvm:: runWholeProgramDevirtOnIndex (
859
857
ModuleSummaryIndex &Summary, std::set<GlobalValue::GUID> &ExportedGUIDs,
860
858
std::map<ValueInfo, std::vector<VTableSlotSummary>> &LocalWPDTargetsMap) {
861
859
DevirtIndex (Summary, ExportedGUIDs, LocalWPDTargetsMap).run ();
862
860
}
863
861
864
- void updateIndexWPDForExports (
862
+ void llvm:: updateIndexWPDForExports (
865
863
ModuleSummaryIndex &Summary,
866
864
function_ref<bool (StringRef, ValueInfo)> isExported,
867
865
std::map<ValueInfo, std::vector<VTableSlotSummary>> &LocalWPDTargetsMap) {
@@ -887,8 +885,6 @@ void updateIndexWPDForExports(
887
885
}
888
886
}
889
887
890
- } // end namespace llvm
891
-
892
888
static Error checkCombinedSummaryForTesting (ModuleSummaryIndex *Summary) {
893
889
// Check that summary index contains regular LTO module when performing
894
890
// export to prevent occasional use of index from pure ThinLTO compilation
0 commit comments