[llvm] [ctx_prof] Fix checks in `PGOCtxprofFlattening` (PR #108467)
David Li via llvm-commits
llvm-commits at lists.llvm.org
Fri Sep 13 21:09:00 PDT 2024
================
@@ -198,6 +204,50 @@ class ProfileAnnotator final {
BBInfo &getBBInfo(const BasicBlock &BB) { return BBInfos.find(&BB)->second; }
+ const BBInfo &getBBInfo(const BasicBlock &BB) const {
+ return BBInfos.find(&BB)->second;
+ }
+
+ // validation function after we propagate the counters: all BBs and edges'
+ // counters must have a value.
+ bool allCountersAreAssinged() const {
+ for (const auto &BBInfo : BBInfos)
+ if (!BBInfo.second.hasCount())
+ return false;
+ for (const auto &EdgeInfo : EdgeInfos)
+ if (!EdgeInfo.Count.has_value())
+ return false;
+ return true;
+ }
+
+ bool allTakenPathsExit() const {
----------------
david-xl wrote:
add a description for the function. Also make it static?
https://github.com/llvm/llvm-project/pull/108467
More information about the llvm-commits
mailing list