@@ -294,7 +294,7 @@ class AccessConflictAndMergeAnalysis {
294
294
295
295
void
296
296
propagateAccessSetsBottomUp (LoopRegionToAccessedStorage ®ionToStorageMap,
297
- llvm::SmallVector<unsigned , 16 > worklist);
297
+ const llvm::SmallVector<unsigned , 16 > & worklist);
298
298
299
299
void calcBottomUpOrder (llvm::SmallVectorImpl<unsigned > &worklist);
300
300
@@ -505,6 +505,8 @@ void AccessConflictAndMergeAnalysis::mergeState(RegionState &state,
505
505
void AccessConflictAndMergeAnalysis::analyze () {
506
506
identifyBeginAccesses ();
507
507
LoopRegionToAccessedStorage accessSetsOfRegions;
508
+ // Populate a worklist of regions such that the top of the worklist is the
509
+ // innermost loop and the bottom of the worklist is the entry block.
508
510
llvm::SmallVector<unsigned , 16 > worklist;
509
511
calcBottomUpOrder (worklist);
510
512
propagateAccessSetsBottomUp (accessSetsOfRegions, worklist);
@@ -593,9 +595,8 @@ void AccessConflictAndMergeAnalysis::identifyBeginAccesses() {
593
595
// Propagates access summaries bottom-up from nested regions
594
596
void AccessConflictAndMergeAnalysis::propagateAccessSetsBottomUp (
595
597
LoopRegionToAccessedStorage ®ionToStorageMap,
596
- llvm::SmallVector<unsigned , 16 > worklist) {
597
- while (!worklist.empty ()) {
598
- auto regionID = worklist.pop_back_val ();
598
+ const llvm::SmallVector<unsigned , 16 > &worklist) {
599
+ for (unsigned regionID : reverse (worklist)) {
599
600
auto *region = LRFI->getRegion (regionID);
600
601
assert (regionToStorageMap.find (regionID) == regionToStorageMap.end () &&
601
602
" Should not process a region twice" );
0 commit comments