Skip to content

Commit 70220a0

Browse files
committed
LAA: pre-commit tests for strip-gep
1 parent a177be5 commit 70220a0

File tree

1 file changed

+43
-0
lines changed

1 file changed

+43
-0
lines changed

llvm/test/Analysis/LoopAccessAnalysis/symbolic-stride.ll

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,49 @@ exit:
140140
ret void
141141
}
142142

143+
; Test with multiple GEP indices
144+
define void @single_stride_array(ptr noalias %A, ptr noalias %B, i64 %N, i64 %stride) {
145+
; CHECK-LABEL: 'single_stride_array'
146+
; CHECK-NEXT: loop:
147+
; CHECK-NEXT: Report: unsafe dependent memory operations in loop. Use #pragma clang loop distribute(enable) to allow loop distribution to attempt to isolate the offending operations into a separate loop
148+
; CHECK-NEXT: Unsafe indirect dependence.
149+
; CHECK-NEXT: Dependences:
150+
; CHECK-NEXT: IndirectUnsafe:
151+
; CHECK-NEXT: %load = load [2 x i32], ptr %gep.A, align 4 ->
152+
; CHECK-NEXT: store [2 x i32] %ins, ptr %gep.A.next, align 4
153+
; CHECK-EMPTY:
154+
; CHECK-NEXT: Run-time memory checks:
155+
; CHECK-NEXT: Grouped accesses:
156+
; CHECK-EMPTY:
157+
; CHECK-NEXT: Non vectorizable stores to invariant address were not found in loop.
158+
; CHECK-NEXT: SCEV assumptions:
159+
; CHECK-EMPTY:
160+
; CHECK-NEXT: Expressions re-written:
161+
;
162+
entry:
163+
br label %loop
164+
165+
loop:
166+
%iv = phi i64 [ 0, %entry ], [ %iv.next, %loop ]
167+
%mul = mul i64 %iv, %stride
168+
%gep.A = getelementptr inbounds [2 x i32], ptr %A, i64 %mul, i64 1
169+
%load = load [2 x i32], ptr %gep.A, align 4
170+
%gep.B = getelementptr inbounds [2 x i32], ptr %B, i64 %iv
171+
%load_1 = load [2 x i32], ptr %gep.B, align 4
172+
%v1 = extractvalue [2 x i32] %load, 0
173+
%v2 = extractvalue [2 x i32] %load_1, 0
174+
%add = add i32 %v1, %v2
175+
%ins = insertvalue [2 x i32] poison, i32 %add, 0
176+
%iv.next = add nuw nsw i64 %iv, 1
177+
%gep.A.next = getelementptr inbounds [2 x i32], ptr %A, i64 %iv.next
178+
store [2 x i32] %ins, ptr %gep.A.next, align 4
179+
%exitcond = icmp eq i64 %iv.next, %N
180+
br i1 %exitcond, label %exit, label %loop
181+
182+
exit:
183+
ret void
184+
}
185+
143186
define void @single_stride_castexpr(i32 %offset, ptr %src, ptr %dst, i1 %cond) {
144187
; CHECK-LABEL: 'single_stride_castexpr'
145188
; CHECK-NEXT: inner.loop:

0 commit comments

Comments
 (0)