[llvm] [GVN][PGO] Skip GVN if entry BlockFreq is 0 (PR #166336)
via llvm-commits
llvm-commits at lists.llvm.org
Tue Nov 4 00:56:48 PST 2025
github-actions[bot] wrote:
<!--LLVM CODE FORMAT COMMENT: {clang-format}-->
:warning: C/C++ code formatter, clang-format found issues in your code. :warning:
<details>
<summary>
You can test this locally with the following command:
</summary>
``````````bash
git-clang-format --diff origin/main HEAD --extensions cpp -- llvm/lib/Transforms/Scalar/GVN.cpp --diff_from_common_commit
``````````
:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/llvm/lib/Transforms/Scalar/GVN.cpp b/llvm/lib/Transforms/Scalar/GVN.cpp
index 0dcc194ae..285b6b305 100644
--- a/llvm/lib/Transforms/Scalar/GVN.cpp
+++ b/llvm/lib/Transforms/Scalar/GVN.cpp
@@ -894,16 +894,17 @@ PreservedAnalyses GVNPass::run(Function &F, FunctionAnalysisManager &AM) {
MSSA = &AM.getResult<MemorySSAAnalysis>(F);
}
auto &ORE = AM.getResult<OptimizationRemarkEmitterAnalysis>(F);
-
+
// Skip the pass if function has zero entry count in PGO.
- // This indicates that the function is never executed according to the profile data.
+ // This indicates that the function is never executed according to the profile
+ // data.
auto EntryCount = F.getEntryCount();
if (EntryCount && EntryCount->getCount() == 0) {
LLVM_DEBUG(dbgs() << "GVN: Skipping function '" << F.getName()
<< "' with zero profile entry count\n");
return PreservedAnalyses::all();
}
-
+
bool Changed = runImpl(F, AC, DT, TLI, AA, MemDep, LI, &ORE,
MSSA ? &MSSA->getMSSA() : nullptr);
if (!Changed)
``````````
</details>
https://github.com/llvm/llvm-project/pull/166336
More information about the llvm-commits
mailing list