@@ -467,17 +467,20 @@ struct PGOMapping : public ASTWalker {
467
467
// / The next counter value to assign.
468
468
unsigned NextCounter;
469
469
470
+ // / The loaded counter data.
471
+ const llvm::InstrProfRecord &LoadedCounts;
472
+
470
473
// / The map of statements to counters.
471
474
llvm::DenseMap<ASTNode, ProfileCounter> &LoadedCounterMap;
472
- llvm::Expected<llvm::InstrProfRecord> &LoadedCounts;
473
475
llvm::DenseMap<ASTNode, ASTNode> &CondToParentMap;
474
476
llvm::DenseMap<ASTNode, unsigned > CounterMap;
475
477
476
478
PGOMapping (llvm::DenseMap<ASTNode, ProfileCounter> &LoadedCounterMap,
477
- llvm::Expected<llvm:: InstrProfRecord> &LoadedCounts,
479
+ const llvm::InstrProfRecord &LoadedCounts,
478
480
llvm::DenseMap<ASTNode, ASTNode> &RegionCondToParentMap)
479
- : NextCounter(0 ), LoadedCounterMap(LoadedCounterMap),
480
- LoadedCounts (LoadedCounts), CondToParentMap(RegionCondToParentMap) {}
481
+ : NextCounter(0 ), LoadedCounts(LoadedCounts),
482
+ LoadedCounterMap (LoadedCounterMap),
483
+ CondToParentMap(RegionCondToParentMap) {}
481
484
482
485
unsigned getParentCounter () const {
483
486
if (Parent.isNull ())
@@ -516,7 +519,7 @@ struct PGOMapping : public ASTWalker {
516
519
" region does not have an associated counter" );
517
520
518
521
unsigned CounterIndexForFunc = CounterIt->second ;
519
- return LoadedCounts-> Counts [CounterIndexForFunc];
522
+ return LoadedCounts. Counts [CounterIndexForFunc];
520
523
}
521
524
522
525
bool walkToDeclPre (Decl *D) override {
@@ -552,7 +555,7 @@ struct PGOMapping : public ASTWalker {
552
555
if (!parent) {
553
556
auto thenVal = thenCount.getValue ();
554
557
for (auto pCount = NextCounter - 1 ; pCount > 0 ; --pCount) {
555
- auto cCount = LoadedCounts-> Counts [pCount];
558
+ auto cCount = LoadedCounts. Counts [pCount];
556
559
if (cCount > thenVal) {
557
560
count = cCount;
558
561
break ;
@@ -642,7 +645,7 @@ struct PGOMapping : public ASTWalker {
642
645
if (!parent) {
643
646
auto thenVal = thenCount.getValue ();
644
647
for (auto pCount = NextCounter - 1 ; pCount > 0 ; --pCount) {
645
- auto cCount = LoadedCounts-> Counts [pCount];
648
+ auto cCount = LoadedCounts. Counts [pCount];
646
649
if (cCount > thenVal) {
647
650
count = cCount;
648
651
break ;
@@ -1186,7 +1189,7 @@ void SILProfiler::assignRegionCounters() {
1186
1189
llvm::dbgs () << PGOFuncName << " \n " ;
1187
1190
return ;
1188
1191
}
1189
- PGOMapping pgoMapper (RegionLoadedCounterMap, LoadedCounts,
1192
+ PGOMapping pgoMapper (RegionLoadedCounterMap, LoadedCounts. get () ,
1190
1193
RegionCondToParentMap);
1191
1194
Root.walk (pgoMapper);
1192
1195
}
0 commit comments