Skip to content

Commit ead8586

Browse files
committed
[InstrProfiling] Add comments for no runtime hook
This patch adds comments about c7f91e2, and follows LLVM style guideline about nested if statements.
1 parent 34b9b1e commit ead8586

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

llvm/lib/Transforms/Instrumentation/InstrProfiling.cpp

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -562,13 +562,15 @@ bool InstrProfiling::run(
562562
if (NeedsRuntimeHook)
563563
MadeChange = emitRuntimeHook();
564564

565-
// Improve compile time by avoiding linear scans when there is no work.
566565
GlobalVariable *CoverageNamesVar =
567566
M.getNamedGlobal(getCoverageUnusedNamesVarName());
568-
if (!containsProfilingIntrinsics(M)) {
569-
if (!CoverageNamesVar || !NeedsRuntimeHook) {
570-
return MadeChange;
571-
}
567+
// Improve compile time by avoiding linear scans when there is no work.
568+
// When coverage is enabled on code that is eliminated by the front-end,
569+
// e.g. unused functions with internal linkage, and the target does not
570+
// require pulling in profile runtime, there is no need to do further work.
571+
if (!containsProfilingIntrinsics(M) &&
572+
(!CoverageNamesVar || !NeedsRuntimeHook)) {
573+
return MadeChange;
572574
}
573575

574576
// We did not know how many value sites there would be inside

0 commit comments

Comments
 (0)