This is the preliminary patch of converting LoopInterchange pass to a loop-nest pass and has no intended functional change.
Changes that are not loop-nest related are split to D96650.
Details
- Reviewers
Whitney - Commits
- rG0eeaec2a6d5f: [NFC] Refactor LoopInterchange into a loop-nest pass
Diff Detail
- Repository
- rG LLVM Github Monorepo
Unit Tests
Event Timeline
Can we have a separate patch for Besides replacing Loop with LoopNest, this patch also removes the parameters OuterLoopId in many functions since it always has the value of InnerLoopId - 1. first?
llvm/include/llvm/Analysis/LoopNestAnalysis.h | ||
---|---|---|
142 | I am not sure it is clear that getHeader of a loop nest is the outermost loop header. maybe adding a getParent() is more appropriate? | |
llvm/lib/Transforms/Scalar/LoopInterchange.cpp | ||
477 | can we keep the const? | |
530 | why is it safe to remove // Loops interchanged reflect the same in LoopList std::swap(LoopList[i - 1], LoopList[i]); |
llvm/lib/Transforms/Scalar/LoopInterchange.cpp | ||
---|---|---|
477 | I thought that ArrayRef is by definition a constant reference to the array. Am I missing something here? | |
530 | Because previously the only place where LoopList is used is to retrieve the InnerLoop and OuterLoop to be interchanged by their indices in the array. After D96650, both loops are now explicitly passed to processLoop and thus maintaining the order of the loops in LoopList is irrelevant now. |
I am not sure it is clear that getHeader of a loop nest is the outermost loop header.
Looks like you added it for getting the loopnest function?
Function &F = *LN.getHeader()->getParent();
maybe adding a getParent() is more appropriate?