@@ -181,7 +181,7 @@ static void mergeInlinedArrayAllocas(
181
181
182
182
// Loop over all the allocas we have so far and see if they can be merged with
183
183
// a previously inlined alloca. If not, remember that we had it.
184
- for (unsigned AllocaNo = 0 , e = IFI.StaticAllocas .size (); AllocaNo != e ;
184
+ for (unsigned AllocaNo = 0 , E = IFI.StaticAllocas .size (); AllocaNo != E ;
185
185
++AllocaNo) {
186
186
AllocaInst *AI = IFI.StaticAllocas [AllocaNo];
187
187
@@ -272,7 +272,7 @@ static void mergeInlinedArrayAllocas(
272
272
// / available from other functions inlined into the caller. If we are able to
273
273
// / inline this call site we attempt to reuse already available allocas or add
274
274
// / any new allocas to the set if not possible.
275
- static InlineResult InlineCallIfPossible (
275
+ static InlineResult inlineCallIfPossible (
276
276
CallBase &CS, InlineFunctionInfo &IFI,
277
277
InlinedArrayAllocasTy &InlinedArrayAllocas, int InlineHistory,
278
278
bool InsertLifetime, function_ref<AAResults &(Function &)> &AARGetter,
@@ -338,7 +338,7 @@ shouldBeDeferred(Function *Caller, InlineCost IC, int &TotalSecondaryCost,
338
338
// can apply a huge negative bonus to TotalSecondaryCost.
339
339
bool ApplyLastCallBonus = Caller->hasLocalLinkage () && !Caller->hasOneUse ();
340
340
// This bool tracks what happens if we DO inline C into B.
341
- bool inliningPreventsSomeOuterInline = false ;
341
+ bool InliningPreventsSomeOuterInline = false ;
342
342
for (User *U : Caller->users ()) {
343
343
// If the caller will not be removed (either because it does not have a
344
344
// local linkage or because the LastCallToStaticBonus has been already
@@ -368,7 +368,7 @@ shouldBeDeferred(Function *Caller, InlineCost IC, int &TotalSecondaryCost,
368
368
// this callsite. We subtract off the penalty for the call instruction,
369
369
// which we would be deleting.
370
370
if (IC2.getCostDelta () <= CandidateCost) {
371
- inliningPreventsSomeOuterInline = true ;
371
+ InliningPreventsSomeOuterInline = true ;
372
372
TotalSecondaryCost += IC2.getCost ();
373
373
}
374
374
}
@@ -379,10 +379,7 @@ shouldBeDeferred(Function *Caller, InlineCost IC, int &TotalSecondaryCost,
379
379
if (ApplyLastCallBonus)
380
380
TotalSecondaryCost -= InlineConstants::LastCallToStaticBonus;
381
381
382
- if (inliningPreventsSomeOuterInline && TotalSecondaryCost < IC.getCost ())
383
- return true ;
384
-
385
- return false ;
382
+ return InliningPreventsSomeOuterInline && TotalSecondaryCost < IC.getCost ();
386
383
}
387
384
388
385
static std::basic_ostream<char > &operator <<(std::basic_ostream<char > &R,
@@ -479,7 +476,7 @@ shouldInline(CallBase &CS, function_ref<InlineCost(CallBase &CS)> GetInlineCost,
479
476
480
477
// / Return true if the specified inline history ID
481
478
// / indicates an inline history that includes the specified function.
482
- static bool InlineHistoryIncludes (
479
+ static bool inlineHistoryIncludes (
483
480
Function *F, int InlineHistoryID,
484
481
const SmallVectorImpl<std::pair<Function *, int >> &InlineHistory) {
485
482
while (InlineHistoryID != -1 ) {
@@ -504,9 +501,9 @@ bool LegacyInlinerBase::runOnSCC(CallGraphSCC &SCC) {
504
501
return inlineCalls (SCC);
505
502
}
506
503
507
- static void emit_inlined_into (OptimizationRemarkEmitter &ORE, DebugLoc &DLoc,
508
- const BasicBlock *Block, const Function &Callee,
509
- const Function &Caller, const InlineCost &IC) {
504
+ static void emitInlinedInto (OptimizationRemarkEmitter &ORE, DebugLoc &DLoc,
505
+ const BasicBlock *Block, const Function &Callee,
506
+ const Function &Caller, const InlineCost &IC) {
510
507
ORE.emit ([&]() {
511
508
bool AlwaysInline = IC.isAlways ();
512
509
StringRef RemarkName = AlwaysInline ? " AlwaysInline" : " Inlined" ;
@@ -520,8 +517,8 @@ static void setInlineRemark(CallBase &CS, StringRef Message) {
520
517
if (!InlineRemarkAttribute)
521
518
return ;
522
519
523
- Attribute attr = Attribute::get (CS.getContext (), " inline-remark" , Message);
524
- CS.addAttribute (AttributeList::FunctionIndex, attr );
520
+ Attribute Attr = Attribute::get (CS.getContext (), " inline-remark" , Message);
521
+ CS.addAttribute (AttributeList::FunctionIndex, Attr );
525
522
}
526
523
527
524
static bool
@@ -598,10 +595,10 @@ inlineCallsImpl(CallGraphSCC &SCC, CallGraph &CG,
598
595
// Now that we have all of the call sites, move the ones to functions in the
599
596
// current SCC to the end of the list.
600
597
unsigned FirstCallInSCC = CallSites.size ();
601
- for (unsigned i = 0 ; i < FirstCallInSCC; ++i )
602
- if (Function *F = CallSites[i ].first ->getCalledFunction ())
598
+ for (unsigned I = 0 ; I < FirstCallInSCC; ++I )
599
+ if (Function *F = CallSites[I ].first ->getCalledFunction ())
603
600
if (SCCFunctions.count (F))
604
- std::swap (CallSites[i --], CallSites[--FirstCallInSCC]);
601
+ std::swap (CallSites[I --], CallSites[--FirstCallInSCC]);
605
602
606
603
InlinedArrayAllocasTy InlinedArrayAllocas;
607
604
InlineFunctionInfo InlineInfo (&CG, &GetAssumptionCache, PSI);
@@ -639,7 +636,7 @@ inlineCallsImpl(CallGraphSCC &SCC, CallGraph &CG,
639
636
// infinitely inline.
640
637
InlineHistoryID = CallSites[CSi].second ;
641
638
if (InlineHistoryID != -1 &&
642
- InlineHistoryIncludes (Callee, InlineHistoryID, InlineHistory)) {
639
+ inlineHistoryIncludes (Callee, InlineHistoryID, InlineHistory)) {
643
640
setInlineRemark (CS, " recursive" );
644
641
continue ;
645
642
}
@@ -684,7 +681,7 @@ inlineCallsImpl(CallGraphSCC &SCC, CallGraph &CG,
684
681
// Attempt to inline the function.
685
682
using namespace ore ;
686
683
687
- InlineResult IR = InlineCallIfPossible (
684
+ InlineResult IR = inlineCallIfPossible (
688
685
CS, InlineInfo, InlinedArrayAllocas, InlineHistoryID,
689
686
InsertLifetime, AARGetter, ImportedFunctionsStats);
690
687
if (!IR.isSuccess ()) {
@@ -701,7 +698,7 @@ inlineCallsImpl(CallGraphSCC &SCC, CallGraph &CG,
701
698
}
702
699
++NumInlined;
703
700
704
- emit_inlined_into (ORE, DLoc, Block, *Callee, *Caller, *OIC);
701
+ emitInlinedInto (ORE, DLoc, Block, *Callee, *Caller, *OIC);
705
702
706
703
// If inlining this function gave us any new call sites, throw them
707
704
// onto our worklist to process. They are useful inline candidates.
@@ -784,8 +781,8 @@ bool LegacyInlinerBase::inlineCalls(CallGraphSCC &SCC) {
784
781
};
785
782
return inlineCallsImpl (
786
783
SCC, CG, GetAssumptionCache, PSI, GetTLI, InsertLifetime,
787
- [this ](CallBase &CS) { return getInlineCost (CS); },
788
- LegacyAARGetter (* this ), ImportedFunctionsStats);
784
+ [& ](CallBase &CS) { return getInlineCost (CS); }, LegacyAARGetter (* this ) ,
785
+ ImportedFunctionsStats);
789
786
}
790
787
791
788
// / Remove now-dead linkonce functions at the end of
@@ -986,17 +983,17 @@ PreservedAnalyses InlinerPass::run(LazyCallGraph::SCC &InitialC,
986
983
987
984
// Loop forward over all of the calls. Note that we cannot cache the size as
988
985
// inlining can introduce new calls that need to be processed.
989
- for (int i = 0 ; i < (int )Calls.size (); ++i ) {
986
+ for (int I = 0 ; I < (int )Calls.size (); ++I ) {
990
987
// We expect the calls to typically be batched with sequences of calls that
991
988
// have the same caller, so we first set up some shared infrastructure for
992
989
// this caller. We also do any pruning we can at this layer on the caller
993
990
// alone.
994
- Function &F = *Calls[i ].first ->getCaller ();
991
+ Function &F = *Calls[I ].first ->getCaller ();
995
992
LazyCallGraph::Node &N = *CG.lookup (F);
996
993
if (CG.lookupSCC (N) != C)
997
994
continue ;
998
995
if (F.hasOptNone ()) {
999
- setInlineRemark (*Calls[i ].first , " optnone attribute" );
996
+ setInlineRemark (*Calls[I ].first , " optnone attribute" );
1000
997
continue ;
1001
998
}
1002
999
@@ -1041,14 +1038,14 @@ PreservedAnalyses InlinerPass::run(LazyCallGraph::SCC &InitialC,
1041
1038
// We bail out as soon as the caller has to change so we can update the
1042
1039
// call graph and prepare the context of that new caller.
1043
1040
bool DidInline = false ;
1044
- for (; i < (int )Calls.size () && Calls[i ].first ->getCaller () == &F; ++i ) {
1041
+ for (; I < (int )Calls.size () && Calls[I ].first ->getCaller () == &F; ++I ) {
1045
1042
int InlineHistoryID;
1046
1043
CallBase *CS = nullptr ;
1047
- std::tie (CS, InlineHistoryID) = Calls[i ];
1044
+ std::tie (CS, InlineHistoryID) = Calls[I ];
1048
1045
Function &Callee = *CS->getCalledFunction ();
1049
1046
1050
1047
if (InlineHistoryID != -1 &&
1051
- InlineHistoryIncludes (&Callee, InlineHistoryID, InlineHistory)) {
1048
+ inlineHistoryIncludes (&Callee, InlineHistoryID, InlineHistory)) {
1052
1049
setInlineRemark (*CS, " recursive" );
1053
1050
continue ;
1054
1051
}
@@ -1111,7 +1108,7 @@ PreservedAnalyses InlinerPass::run(LazyCallGraph::SCC &InitialC,
1111
1108
1112
1109
++NumInlined;
1113
1110
1114
- emit_inlined_into (ORE, DLoc, Block, Callee, F, *OIC);
1111
+ emitInlinedInto (ORE, DLoc, Block, Callee, F, *OIC);
1115
1112
1116
1113
// Add any new callsites to defined functions to the worklist.
1117
1114
if (!IFI.InlinedCallSites .empty ()) {
@@ -1152,8 +1149,8 @@ PreservedAnalyses InlinerPass::run(LazyCallGraph::SCC &InitialC,
1152
1149
Callee.removeDeadConstantUsers ();
1153
1150
if (Callee.use_empty () && !CG.isLibFunction (Callee)) {
1154
1151
Calls.erase (
1155
- std::remove_if (Calls.begin () + i + 1 , Calls.end (),
1156
- [&Callee ](const std::pair<CallBase *, int > &Call) {
1152
+ std::remove_if (Calls.begin () + I + 1 , Calls.end (),
1153
+ [&](const std::pair<CallBase *, int > &Call) {
1157
1154
return Call.first ->getCaller () == &Callee;
1158
1155
}),
1159
1156
Calls.end ());
@@ -1171,7 +1168,7 @@ PreservedAnalyses InlinerPass::run(LazyCallGraph::SCC &InitialC,
1171
1168
1172
1169
// Back the call index up by one to put us in a good position to go around
1173
1170
// the outer loop.
1174
- --i ;
1171
+ --I ;
1175
1172
1176
1173
if (!DidInline)
1177
1174
continue ;
0 commit comments