Skip to content

Commit 681939e

Browse files
committed
[LAA] Add phi test variant for cross-iteration dependence (NFC)
1 parent c727b48 commit 681939e

File tree

1 file changed

+41
-0
lines changed

1 file changed

+41
-0
lines changed

llvm/test/Analysis/LoopAccessAnalysis/select-dependence.ll

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,3 +39,44 @@ loop:
3939
exit:
4040
ret void
4141
}
42+
43+
; Same as previous test, but with selects replaced by phis in the same block.
44+
define void @test_phi(ptr noalias %x, ptr noalias %y, ptr noalias %z) {
45+
; CHECK-LABEL: 'test_phi'
46+
; CHECK-NEXT: loop:
47+
; CHECK-NEXT: Memory dependences are safe
48+
; CHECK-NEXT: Dependences:
49+
; CHECK-NEXT: Run-time memory checks:
50+
; CHECK-NEXT: Grouped accesses:
51+
; CHECK-EMPTY:
52+
; CHECK-NEXT: Non vectorizable stores to invariant address were not found in loop.
53+
; CHECK-NEXT: SCEV assumptions:
54+
; CHECK-EMPTY:
55+
; CHECK-NEXT: Expressions re-written:
56+
;
57+
entry:
58+
%gep.y = getelementptr double, ptr %y, i64 -32
59+
br label %loop
60+
61+
loop:
62+
%iv = phi i64 [ %iv.next, %latch ], [ 0, %entry ]
63+
%icmp = icmp ule i64 %iv, 32
64+
br i1 %icmp, label %if, label %latch
65+
66+
if:
67+
br label %latch
68+
69+
latch:
70+
%sel = phi ptr [ %x, %if ], [ %gep.y, %loop ]
71+
%sel2 = phi ptr [ %y, %if ], [ %z, %loop ]
72+
%gep.sel = getelementptr inbounds double, ptr %sel, i64 %iv
73+
%load = load double, ptr %gep.sel, align 8
74+
%gep.sel2 = getelementptr inbounds double, ptr %sel2, i64 %iv
75+
store double %load, ptr %gep.sel2, align 8
76+
%iv.next = add nuw nsw i64 %iv, 1
77+
%exit.cond = icmp eq i64 %iv, 94
78+
br i1 %exit.cond, label %exit, label %loop
79+
80+
exit:
81+
ret void
82+
}

0 commit comments

Comments
 (0)