Skip to content

Commit 1a11302

Browse files
committed
[LoopInterchange] Skip dependence check to the same instruction
1 parent a5e45b1 commit 1a11302

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

llvm/lib/Transforms/Scalar/LoopInterchange.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ static bool populateDependencyMatrix(CharMatrix &DepMatrix, unsigned Level,
113113
ValueVector::iterator I, IE, J, JE;
114114

115115
for (I = MemInstr.begin(), IE = MemInstr.end(); I != IE; ++I) {
116-
for (J = I, JE = MemInstr.end(); J != JE; ++J) {
116+
for (J = I + 1, JE = MemInstr.end(); J != JE; ++J) {
117117
std::vector<char> Dep;
118118
Instruction *Src = cast<Instruction>(*I);
119119
Instruction *Dst = cast<Instruction>(*J);

llvm/test/Transforms/LoopInterchange/interchange-s231.ll

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@
1010
;; for (int j = 1; j < 256; j++)
1111
;; aa[j][i] = aa[j - 1][i] + bb[j][i];
1212

13-
; CHECK: Found output dependency between Src and Dst
14-
; CHECK: Src: store float %add, ptr %arrayidx18
15-
; CHECK: Dst: store float %add, ptr %arrayidx18
13+
; CHECK: Found anti dependency between Src and Dst
14+
; CHECK: Src: %1 = load float, ptr %arrayidx10, align 4
15+
; CHECK: Dst: store float %add, ptr %arrayidx18, align 4
1616
; CHECK: Processing InnerLoopId = 2 and OuterLoopId = 1
1717
; CHECK: Not interchanging loops. Cannot prove legality.
1818

0 commit comments

Comments
 (0)