11
11
//
12
12
// ===----------------------------------------------------------------------===//
13
13
14
- #include " llvm/Analysis /ModuleSummaryAnalysis.h"
14
+ #include " llvm/Object /ModuleSummaryAnalysis.h"
15
15
#include " llvm/ADT/ArrayRef.h"
16
16
#include " llvm/ADT/DenseSet.h"
17
17
#include " llvm/ADT/MapVector.h"
@@ -327,7 +327,8 @@ static void computeFunctionSummary(ModuleSummaryIndex &Index, const Module &M,
327
327
// Check if this is an alias to a function. If so, get the
328
328
// called aliasee for the checks below.
329
329
if (auto *GA = dyn_cast<GlobalAlias>(CalledValue)) {
330
- assert (!CalledFunction && " Expected null called function in callsite for alias" );
330
+ assert (!CalledFunction &&
331
+ " Expected null called function in callsite for alias" );
331
332
CalledFunction = dyn_cast<Function>(GA->getBaseObject ());
332
333
}
333
334
// Check if this is a direct call to a known function or a known
@@ -460,7 +461,8 @@ static void computeFunctionSummary(ModuleSummaryIndex &Index, const Module &M,
460
461
NonRenamableLocal || HasInlineAsmMaybeReferencingInternal;
461
462
GlobalValueSummary::GVFlags Flags (F.getLinkage (), NotEligibleForImport,
462
463
/* Live = */ false , F.isDSOLocal (),
463
- F.hasLinkOnceODRLinkage () && F.hasGlobalUnnamedAddr ());
464
+ F.hasLinkOnceODRLinkage () &&
465
+ F.hasGlobalUnnamedAddr ());
464
466
FunctionSummary::FFlags FunFlags{
465
467
F.hasFnAttribute (Attribute::ReadNone),
466
468
F.hasFnAttribute (Attribute::ReadOnly),
@@ -578,7 +580,8 @@ static void computeVariableSummary(ModuleSummaryIndex &Index,
578
580
bool NonRenamableLocal = isNonRenamableLocal (V);
579
581
GlobalValueSummary::GVFlags Flags (V.getLinkage (), NonRenamableLocal,
580
582
/* Live = */ false , V.isDSOLocal (),
581
- V.hasLinkOnceODRLinkage () && V.hasGlobalUnnamedAddr ());
583
+ V.hasLinkOnceODRLinkage () &&
584
+ V.hasGlobalUnnamedAddr ());
582
585
583
586
VTableFuncList VTableFuncs;
584
587
// If splitting is not enabled, then we compute the summary information
@@ -604,7 +607,7 @@ static void computeVariableSummary(ModuleSummaryIndex &Index,
604
607
Constant ? false : CanBeInternalized,
605
608
Constant, V.getVCallVisibility ());
606
609
auto GVarSummary = std::make_unique<GlobalVarSummary>(Flags, VarFlags,
607
- RefEdges.takeVector ());
610
+ RefEdges.takeVector ());
608
611
if (NonRenamableLocal)
609
612
CantBePromoted.insert (V.getGUID ());
610
613
if (HasBlockAddress)
@@ -614,13 +617,13 @@ static void computeVariableSummary(ModuleSummaryIndex &Index,
614
617
Index.addGlobalValueSummary (V, std::move (GVarSummary));
615
618
}
616
619
617
- static void
618
- computeAliasSummary (ModuleSummaryIndex &Index, const GlobalAlias &A,
619
- DenseSet<GlobalValue::GUID> &CantBePromoted) {
620
+ static void computeAliasSummary (ModuleSummaryIndex &Index, const GlobalAlias &A,
621
+ DenseSet<GlobalValue::GUID> &CantBePromoted) {
620
622
bool NonRenamableLocal = isNonRenamableLocal (A);
621
623
GlobalValueSummary::GVFlags Flags (A.getLinkage (), NonRenamableLocal,
622
624
/* Live = */ false , A.isDSOLocal (),
623
- A.hasLinkOnceODRLinkage () && A.hasGlobalUnnamedAddr ());
625
+ A.hasLinkOnceODRLinkage () &&
626
+ A.hasGlobalUnnamedAddr ());
624
627
auto AS = std::make_unique<AliasSummary>(Flags);
625
628
auto *Aliasee = A.getBaseObject ();
626
629
auto AliaseeVI = Index.getValueInfo (Aliasee->getGUID ());
@@ -691,12 +694,14 @@ ModuleSummaryIndex llvm::buildModuleSummaryIndex(
691
694
GlobalValue *GV = M.getNamedValue (Name);
692
695
if (!GV)
693
696
return ;
694
- assert (GV->isDeclaration () && " Def in module asm already has definition" );
697
+ assert (GV->isDeclaration () &&
698
+ " Def in module asm already has definition" );
695
699
GlobalValueSummary::GVFlags GVFlags (GlobalValue::InternalLinkage,
696
700
/* NotEligibleToImport = */ true ,
697
701
/* Live = */ true ,
698
702
/* Local */ GV->isDSOLocal (),
699
- GV->hasLinkOnceODRLinkage () && GV->hasGlobalUnnamedAddr ());
703
+ GV->hasLinkOnceODRLinkage () &&
704
+ GV->hasGlobalUnnamedAddr ());
700
705
CantBePromoted.insert (GV->getGUID ());
701
706
// Create the appropriate summary type.
702
707
if (Function *F = dyn_cast<Function>(GV)) {
@@ -834,8 +839,8 @@ ModuleSummaryIndex llvm::buildModuleSummaryIndex(
834
839
835
840
AnalysisKey ModuleSummaryIndexAnalysis::Key;
836
841
837
- ModuleSummaryIndex
838
- ModuleSummaryIndexAnalysis::run (Module &M, ModuleAnalysisManager &AM) {
842
+ ModuleSummaryIndex ModuleSummaryIndexAnalysis::run (Module &M,
843
+ ModuleAnalysisManager &AM) {
839
844
ProfileSummaryInfo &PSI = AM.getResult <ProfileSummaryAnalysis>(M);
840
845
auto &FAM = AM.getResult <FunctionAnalysisManagerModuleProxy>(M).getManager ();
841
846
return buildModuleSummaryIndex (
0 commit comments