Skip to content

Commit

Permalink
Iterate basic blocks in reverse order in liveness analysis
Browse files Browse the repository at this point in the history
Makes iteration faster to converge.
  • Loading branch information
stefan-il authored and igcbot committed Dec 5, 2024
1 parent 6619878 commit 09e2ecf
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions IGC/Compiler/CISACodeGen/IGCLivenessAnalysis.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ SPDX-License-Identifier: MIT
#include "GenISAIntrinsics/GenIntrinsicInst.h"
#include "common/debug/Debug.hpp"
#include "common/igc_regkeys.hpp"
#include "llvmWrapper/IR/Function.h"

#include <fstream>
#include <queue>
Expand Down Expand Up @@ -232,8 +233,9 @@ void IGCLivenessAnalysisBase::livenessAnalysis(llvm::Function &F, BBSet *StartBB
{
// Start with adding all BBs to the Worklist
// to make sure In set is populated for every BB
for (BasicBlock &BB : F)
Worklist.push(&BB);
for (auto BBIt = IGCLLVM::rbegin(&F); BBIt != IGCLLVM::rend(&F); ++BBIt) {
Worklist.push(&*BBIt);
}
}

while (!Worklist.empty()) {
Expand Down

0 comments on commit 09e2ecf

Please sign in to comment.