Skip to content

Commit 3710078

Browse files
[SampleProfile] Reduce indentation with an early return (NFC)
1 parent 0352ee1 commit 3710078

File tree

1 file changed

+36
-36
lines changed

1 file changed

+36
-36
lines changed

llvm/lib/Transforms/IPO/SampleProfile.cpp

Lines changed: 36 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1226,45 +1226,45 @@ bool SampleProfileLoader::tryInlineCandidate(
12261226

12271227
InlineFunctionInfo IFI(nullptr, GetAC);
12281228
IFI.UpdateProfile = false;
1229-
if (InlineFunction(CB, IFI).isSuccess()) {
1230-
// Merge the attributes based on the inlining.
1231-
AttributeFuncs::mergeAttributesForInlining(*BB->getParent(),
1232-
*CalledFunction);
1233-
1234-
// The call to InlineFunction erases I, so we can't pass it here.
1235-
emitInlinedIntoBasedOnCost(*ORE, DLoc, BB, *CalledFunction,
1236-
*BB->getParent(), Cost, true, CSINLINE_DEBUG);
1237-
1238-
// Now populate the list of newly exposed call sites.
1239-
if (InlinedCallSites) {
1240-
InlinedCallSites->clear();
1241-
for (auto &I : IFI.InlinedCallSites)
1242-
InlinedCallSites->push_back(I);
1243-
}
1229+
if (!InlineFunction(CB, IFI).isSuccess())
1230+
return false;
12441231

1245-
if (ProfileIsCSFlat)
1246-
ContextTracker->markContextSamplesInlined(Candidate.CalleeSamples);
1247-
++NumCSInlined;
1248-
1249-
// Prorate inlined probes for a duplicated inlining callsite which probably
1250-
// has a distribution less than 100%. Samples for an inlinee should be
1251-
// distributed among the copies of the original callsite based on each
1252-
// callsite's distribution factor for counts accuracy. Note that an inlined
1253-
// probe may come with its own distribution factor if it has been duplicated
1254-
// in the inlinee body. The two factor are multiplied to reflect the
1255-
// aggregation of duplication.
1256-
if (Candidate.CallsiteDistribution < 1) {
1257-
for (auto &I : IFI.InlinedCallSites) {
1258-
if (Optional<PseudoProbe> Probe = extractProbe(*I))
1259-
setProbeDistributionFactor(*I, Probe->Factor *
1260-
Candidate.CallsiteDistribution);
1261-
}
1262-
NumDuplicatedInlinesite++;
1263-
}
1232+
// Merge the attributes based on the inlining.
1233+
AttributeFuncs::mergeAttributesForInlining(*BB->getParent(),
1234+
*CalledFunction);
12641235

1265-
return true;
1236+
// The call to InlineFunction erases I, so we can't pass it here.
1237+
emitInlinedIntoBasedOnCost(*ORE, DLoc, BB, *CalledFunction,
1238+
*BB->getParent(), Cost, true, CSINLINE_DEBUG);
1239+
1240+
// Now populate the list of newly exposed call sites.
1241+
if (InlinedCallSites) {
1242+
InlinedCallSites->clear();
1243+
for (auto &I : IFI.InlinedCallSites)
1244+
InlinedCallSites->push_back(I);
12661245
}
1267-
return false;
1246+
1247+
if (ProfileIsCSFlat)
1248+
ContextTracker->markContextSamplesInlined(Candidate.CalleeSamples);
1249+
++NumCSInlined;
1250+
1251+
// Prorate inlined probes for a duplicated inlining callsite which probably
1252+
// has a distribution less than 100%. Samples for an inlinee should be
1253+
// distributed among the copies of the original callsite based on each
1254+
// callsite's distribution factor for counts accuracy. Note that an inlined
1255+
// probe may come with its own distribution factor if it has been duplicated
1256+
// in the inlinee body. The two factor are multiplied to reflect the
1257+
// aggregation of duplication.
1258+
if (Candidate.CallsiteDistribution < 1) {
1259+
for (auto &I : IFI.InlinedCallSites) {
1260+
if (Optional<PseudoProbe> Probe = extractProbe(*I))
1261+
setProbeDistributionFactor(*I, Probe->Factor *
1262+
Candidate.CallsiteDistribution);
1263+
}
1264+
NumDuplicatedInlinesite++;
1265+
}
1266+
1267+
return true;
12681268
}
12691269

12701270
bool SampleProfileLoader::getInlineCandidate(InlineCandidate *NewCandidate,

0 commit comments

Comments
 (0)