From ff281f7d37ead15bdbdbfccb4b82ea93013b1a00 Mon Sep 17 00:00:00 2001 From: ronryvchin <94285266+ronryvchin@users.noreply.github.com> Date: Wed, 4 Dec 2024 08:56:46 +0200 Subject: [PGO] Add option to always instrumenting loop entries (#116789) This patch extends the PGO infrastructure with an option to prefer the instrumentation of loop entry blocks. This option is a generalization of https://github.com/llvm/llvm-project/commit/19fb5b467bb97f95eace1f3637d2d1041cebd3ce, and helps to cover cases where the loop exit is never executed. An example where this can occur are event handling loops. Note that change does NOT change the default behavior. --- llvm/tools/llvm-profdata/llvm-profdata.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'llvm/tools/llvm-profdata/llvm-profdata.cpp') diff --git a/llvm/tools/llvm-profdata/llvm-profdata.cpp b/llvm/tools/llvm-profdata/llvm-profdata.cpp index 2acf1cc..1d9d7bcf 100644 --- a/llvm/tools/llvm-profdata/llvm-profdata.cpp +++ b/llvm/tools/llvm-profdata/llvm-profdata.cpp @@ -2967,8 +2967,10 @@ static int showInstrProfile(ShowFormat SFormat, raw_fd_ostream &OS) { std::unique_ptr PS(Builder.getSummary()); bool IsIR = Reader->isIRLevelProfile(); OS << "Instrumentation level: " << (IsIR ? "IR" : "Front-end"); - if (IsIR) + if (IsIR) { OS << " entry_first = " << Reader->instrEntryBBEnabled(); + OS << " instrument_loop_entries = " << Reader->instrLoopEntriesEnabled(); + } OS << "\n"; if (ShowAllFunctions || !FuncNameFilter.empty()) OS << "Functions shown: " << ShownFunctions << "\n"; -- cgit v1.1