[llvm] [LoopInterchange] Supported partially-perfect Loop Nests (PR #199511)
Rohit Garg via llvm-commits
llvm-commits at lists.llvm.org
Wed Jun 10 02:25:12 PDT 2026
================
@@ -167,31 +167,36 @@ static bool inThisOrder(const Instruction *Src, const Instruction *Dst) {
#endif
static bool populateDependencyMatrix(CharMatrix &DepMatrix, unsigned Level,
- Loop *L, DependenceInfo *DI,
+ Loop *L, ArrayRef<Loop *> LoopList,
+ LoopInfo *LI, DependenceInfo *DI,
ScalarEvolution *SE,
OptimizationRemarkEmitter *ORE) {
using ValueVector = SmallVector<Value *, 16>;
ValueVector MemInstr;
unsigned NumInsts = 0;
- // For each block.
- for (BasicBlock *BB : L->blocks()) {
- // Scan the BB and collect legal loads and stores.
- for (Instruction &I : *BB) {
- if (!isa<Instruction>(I))
- return false;
- NumInsts++;
- if (!isa<Instruction>(I))
- return false;
- if (auto *Ld = dyn_cast<LoadInst>(&I)) {
- if (!Ld->isSimple())
- return false;
- MemInstr.push_back(&I);
- } else if (auto *St = dyn_cast<StoreInst>(&I)) {
- if (!St->isSimple())
+ // Collect memory instructions from the BB which belongs to all loops in the LoopList
+ for (Loop *PathLoop : LoopList) {
+ for (BasicBlock *BB : PathLoop->getBlocksVector()) {
----------------
rohgarg-qual wrote:
Yeah,` PathLoop->blocks()` alone is not sufficient here. Our goal is to collect only those memory instructions that belong to the loops currently being analyzed. Since we are focusing on just one branch of the loop tree, we should restrict ourselves to dependencies among the memory instructions within that specific branch only.
https://github.com/llvm/llvm-project/pull/199511
More information about the llvm-commits
mailing list