Skip to content

Commit 26a8873

Browse files
fhahnaokblast
authored andcommitted
[LAA] Add additional tests for llvm#161445.
Add extra test variants for llvm#161445.
1 parent 06240a0 commit 26a8873

File tree

1 file changed

+94
-0
lines changed

1 file changed

+94
-0
lines changed

llvm/test/Analysis/LoopAccessAnalysis/inbounds-gep-in-predicated-blocks.ll

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,100 @@ exit:
5454
ret void
5555
}
5656

57+
; Same as @test_inbounds_gep_used_in_predicated_block, but also storing the
58+
; pointer values in the header.
59+
define void @test_inbounds_gep_used_in_predicated_block_stored_value_operand(ptr %A, i64 %n, ptr noalias %B) {
60+
; CHECK-LABEL: 'test_inbounds_gep_used_in_predicated_block_stored_value_operand'
61+
; CHECK-NEXT: loop.header:
62+
; CHECK-NEXT: Memory dependences are safe
63+
; CHECK-NEXT: Dependences:
64+
; CHECK-NEXT: Run-time memory checks:
65+
; CHECK-NEXT: Grouped accesses:
66+
; CHECK-EMPTY:
67+
; CHECK-NEXT: Non vectorizable stores to invariant address were found in loop.
68+
; CHECK-NEXT: SCEV assumptions:
69+
; CHECK-EMPTY:
70+
; CHECK-NEXT: Expressions re-written:
71+
;
72+
entry:
73+
br label %loop.header
74+
75+
loop.header:
76+
%i = phi i64 [ 0, %entry ], [ %i.next, %loop.latch ]
77+
%offset.0 = phi i64 [ 0, %entry ], [ %offset.0.next, %loop.latch ]
78+
%offset.1 = phi i64 [ 0, %entry ], [ %offset.1.next, %loop.latch ]
79+
%idx.0 = getelementptr inbounds i8, ptr %A, i64 %offset.0
80+
%idx.1 = getelementptr inbounds i8, ptr %A, i64 %offset.1
81+
%mask = and i64 %i, 3
82+
%cond = icmp eq i64 %mask, 0
83+
store ptr %idx.0, ptr %B
84+
store ptr %idx.1, ptr %B
85+
br i1 %cond, label %if.then, label %loop.latch
86+
87+
if.then:
88+
store i8 2, ptr %idx.0
89+
store i8 1, ptr %idx.1
90+
br label %loop.latch
91+
92+
loop.latch:
93+
%i.next = add nuw nsw i64 %i, 1
94+
%offset.0.next = add i64 %offset.0, 4611686018427387905 ; 2^62 + 1
95+
%offset.1.next = add i64 %offset.1, 4611686018427387906 ; 2^62 + 2
96+
%cond.exit = icmp eq i64 %i.next, 100
97+
br i1 %cond.exit, label %exit, label %loop.header
98+
99+
exit:
100+
ret void
101+
}
102+
103+
; Same as @test_inbounds_gep_used_in_predicated_block_non_memop_user, but with
104+
; extra GEP users in the header.
105+
define void @test_inbounds_gep_used_in_predicated_block_non_memop_user(ptr %A, i64 %n) {
106+
; CHECK-LABEL: 'test_inbounds_gep_used_in_predicated_block_non_memop_user'
107+
; CHECK-NEXT: loop.header:
108+
; CHECK-NEXT: Memory dependences are safe
109+
; CHECK-NEXT: Dependences:
110+
; CHECK-NEXT: Run-time memory checks:
111+
; CHECK-NEXT: Grouped accesses:
112+
; CHECK-EMPTY:
113+
; CHECK-NEXT: Non vectorizable stores to invariant address were not found in loop.
114+
; CHECK-NEXT: SCEV assumptions:
115+
; CHECK-EMPTY:
116+
; CHECK-NEXT: Expressions re-written:
117+
;
118+
entry:
119+
br label %loop.header
120+
121+
loop.header:
122+
%i = phi i64 [ 0, %entry ], [ %i.next, %loop.latch ]
123+
%offset.0 = phi i64 [ 0, %entry ], [ %offset.0.next, %loop.latch ]
124+
%offset.1 = phi i64 [ 0, %entry ], [ %offset.1.next, %loop.latch ]
125+
%idx.0 = getelementptr inbounds i8, ptr %A, i64 %offset.0
126+
%idx.1 = getelementptr inbounds i8, ptr %A, i64 %offset.1
127+
%mask = and i64 %i, 3
128+
%cond = icmp eq i64 %mask, 0
129+
%gep.idx.0 = getelementptr inbounds i8, ptr %idx.0, i8 1
130+
%gep.idx.1 = getelementptr inbounds i8, ptr %idx.1, i8 1
131+
br i1 %cond, label %if.then, label %loop.latch
132+
133+
if.then:
134+
store i8 2, ptr %idx.0
135+
store i8 1, ptr %idx.1
136+
br label %loop.latch
137+
138+
loop.latch:
139+
%i.next = add nuw nsw i64 %i, 1
140+
%offset.0.next = add i64 %offset.0, 4611686018427387905 ; 2^62 + 1
141+
%offset.1.next = add i64 %offset.1, 4611686018427387906 ; 2^62 + 2
142+
%cond.exit = icmp eq i64 %i.next, 100
143+
br i1 %cond.exit, label %exit, label %loop.header
144+
145+
exit:
146+
store i32 0, ptr %gep.idx.0
147+
store i32 0, ptr %gep.idx.1
148+
ret void
149+
}
150+
57151
define void @test_header_existing(ptr %src, ptr %dst, i64 %start) {
58152
; CHECK-LABEL: 'test_header_existing'
59153
; CHECK-NEXT: loop.header:

0 commit comments

Comments
 (0)