[PATCH] D96650: [NFC] Replace OuterLoopId with InnerLoopId - 1
Ta-Wei Tu via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sat Feb 13 17:13:44 PST 2021
TaWeiTu updated this revision to Diff 323583.
TaWeiTu added a comment.
Address comment: Keep parameter `OuterLoopId`
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D96650/new/
https://reviews.llvm.org/D96650
Files:
llvm/lib/Transforms/Scalar/LoopInterchange.cpp
llvm/test/Transforms/LoopInterchange/interchange-flow-dep-outer.ll
llvm/test/Transforms/LoopInterchange/not-interchanged-loop-nest-3.ll
Index: llvm/test/Transforms/LoopInterchange/not-interchanged-loop-nest-3.ll
===================================================================
--- llvm/test/Transforms/LoopInterchange/not-interchanged-loop-nest-3.ll
+++ llvm/test/Transforms/LoopInterchange/not-interchanged-loop-nest-3.ll
@@ -13,10 +13,10 @@
;; for(int k=0;k<100;k++)
;; D[i][k][j] = D[i][k][j]+t;
-; CHECK: Processing Inner Loop Id = 2 and OuterLoopId = 1
+; CHECK: Processing InnerLoopId = 2 and OuterLoopId = 1
; CHECK: Loops interchanged.
-; CHECK: Processing Inner Loop Id = 1 and OuterLoopId = 0
+; CHECK: Processing InnerLoopId = 1 and OuterLoopId = 0
; CHECK: Interchanging loops not profitable.
define void @interchange_08(i32 %t){
Index: llvm/test/Transforms/LoopInterchange/interchange-flow-dep-outer.ll
===================================================================
--- llvm/test/Transforms/LoopInterchange/interchange-flow-dep-outer.ll
+++ llvm/test/Transforms/LoopInterchange/interchange-flow-dep-outer.ll
@@ -21,10 +21,10 @@
;; fn2(T[k]);
;; }
-; CHECK: Processing Inner Loop Id = 2 and OuterLoopId = 1
+; CHECK: Processing InnerLoopId = 2 and OuterLoopId = 1
; CHECK: Loops interchanged.
-; CHECK: Processing Inner Loop Id = 1 and OuterLoopId = 0
+; CHECK: Processing InnerLoopId = 1 and OuterLoopId = 0
; CHECK: Not interchanging loops. Cannot prove legality.
@T = internal global [100 x double] zeroinitializer, align 4
Index: llvm/lib/Transforms/Scalar/LoopInterchange.cpp
===================================================================
--- llvm/lib/Transforms/Scalar/LoopInterchange.cpp
+++ llvm/lib/Transforms/Scalar/LoopInterchange.cpp
@@ -516,8 +516,8 @@
unsigned SelecLoopId = selectLoopForInterchange(LoopList);
// Move the selected loop outwards to the best possible position.
for (unsigned i = SelecLoopId; i > 0; i--) {
- bool Interchanged =
- processLoop(LoopList, i, i - 1, LoopNestExit, DependencyMatrix);
+ bool Interchanged = processLoop(LoopList[i], LoopList[i - 1], i, i - 1,
+ LoopNestExit, DependencyMatrix);
if (!Interchanged)
return Changed;
// Loops interchanged reflect the same in LoopList
@@ -534,13 +534,11 @@
return Changed;
}
- bool processLoop(LoopVector LoopList, unsigned InnerLoopId,
+ bool processLoop(Loop *InnerLoop, Loop *OuterLoop, unsigned InnerLoopId,
unsigned OuterLoopId, BasicBlock *LoopNestExit,
std::vector<std::vector<char>> &DependencyMatrix) {
- LLVM_DEBUG(dbgs() << "Processing Inner Loop Id = " << InnerLoopId
+ LLVM_DEBUG(dbgs() << "Processing InnerLoopId = " << InnerLoopId
<< " and OuterLoopId = " << OuterLoopId << "\n");
- Loop *InnerLoop = LoopList[InnerLoopId];
- Loop *OuterLoop = LoopList[OuterLoopId];
LoopInterchangeLegality LIL(OuterLoop, InnerLoop, SE, ORE);
if (!LIL.canInterchangeLoops(InnerLoopId, OuterLoopId, DependencyMatrix)) {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D96650.323583.patch
Type: text/x-patch
Size: 3023 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210214/f173c69f/attachment.bin>
More information about the llvm-commits
mailing list