[InstrProfiling] Add comments for no runtime hook

This patch adds comments about c7f91e227a, and
follows LLVM style guideline about nested if statements.
This commit is contained in:
Gulfem Savrun Yeniceri 2022-03-26 00:22:38 +00:00
parent 34b9b1ea48
commit ead8586645
1 changed files with 7 additions and 5 deletions

View File

@ -562,13 +562,15 @@ bool InstrProfiling::run(
if (NeedsRuntimeHook)
MadeChange = emitRuntimeHook();
// Improve compile time by avoiding linear scans when there is no work.
GlobalVariable *CoverageNamesVar =
M.getNamedGlobal(getCoverageUnusedNamesVarName());
if (!containsProfilingIntrinsics(M)) {
if (!CoverageNamesVar || !NeedsRuntimeHook) {
return MadeChange;
}
// Improve compile time by avoiding linear scans when there is no work.
// When coverage is enabled on code that is eliminated by the front-end,
// e.g. unused functions with internal linkage, and the target does not
// require pulling in profile runtime, there is no need to do further work.
if (!containsProfilingIntrinsics(M) &&
(!CoverageNamesVar || !NeedsRuntimeHook)) {
return MadeChange;
}
// We did not know how many value sites there would be inside