Skip to content

Commit 644c902

Browse files
committed
[ctx_prof] Fix nondeterminism in CtxProfAnalysisPrinterPass
Using a `std::map` instead of a `DenseMap` for the FuncInfo member. Addresses the ctx_prof part of Issue #106855
1 parent f93114d commit 644c902

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

llvm/include/llvm/Analysis/CtxProfAnalysis.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ class PGOContextualProfile {
4141
std::optional<PGOCtxProfContext::CallTargetMapTy> Profiles;
4242
// For the GUIDs in this module, associate metadata about each function which
4343
// we'll need when we maintain the profiles during IPO transformations.
44-
DenseMap<GlobalValue::GUID, FunctionInfo> FuncInfo;
44+
std::map<GlobalValue::GUID, FunctionInfo> FuncInfo;
4545

4646
/// Get the GUID of this Function if it's defined in this module.
4747
GlobalValue::GUID getDefinedFunctionGUID(const Function &F) const;

llvm/test/Analysis/CtxProfAnalysis/full-cycle.ll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,10 +116,10 @@ define void @entrypoint() {
116116
]
117117
;--- expected.txt
118118
Function Info:
119-
10507721908651011566 : entrypoint. MaxCounterID: 1. MaxCallsiteID: 2
119+
2072045998141807037 : f1. MaxCounterID: 1. MaxCallsiteID: 1
120120
3087265239403591524 : f2.llvm.0. MaxCounterID: 1. MaxCallsiteID: 0
121121
4197650231481825559 : f3. MaxCounterID: 1. MaxCallsiteID: 1
122-
2072045998141807037 : f1. MaxCounterID: 1. MaxCallsiteID: 1
122+
10507721908651011566 : entrypoint. MaxCounterID: 1. MaxCallsiteID: 2
123123

124124
Current Profile:
125125
[

llvm/test/Analysis/CtxProfAnalysis/load.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,8 @@
5858
;--- expected-profile-output.txt
5959
Function Info:
6060
4909520559318251808 : an_entrypoint. MaxCounterID: 2. MaxCallsiteID: 1
61-
12074870348631550642 : another_entrypoint_no_callees. MaxCounterID: 1. MaxCallsiteID: 0
6261
11872291593386833696 : foo. MaxCounterID: 1. MaxCallsiteID: 1
62+
12074870348631550642 : another_entrypoint_no_callees. MaxCounterID: 1. MaxCallsiteID: 0
6363

6464
Current Profile:
6565
[

0 commit comments

Comments
 (0)