6
6
; same indices could be loaded in later iterations.
7
7
; FIXME: currently this is incorrectly considered safe for vectorization with
8
8
; runtime checks
9
- define void @B_indices_loaded_in_loop_A_stored (ptr %A , ptr noalias %B , i64 %N ) {
9
+ define void @B_indices_loaded_in_loop_A_stored (ptr %A , ptr noalias %B , i64 %N , i64 %off ) {
10
10
; CHECK-LABEL: 'B_indices_loaded_in_loop_A_stored'
11
11
; CHECK-NEXT: loop:
12
12
; CHECK-NEXT: Memory dependences are safe with run-time checks
13
13
; CHECK-NEXT: Dependences:
14
14
; CHECK-NEXT: Run-time memory checks:
15
15
; CHECK-NEXT: Check 0:
16
16
; CHECK-NEXT: Comparing group ([[GRP1:0x[0-9a-f]+]]):
17
- ; CHECK-NEXT: %gep.A.1 = getelementptr inbounds i32, ptr %A, i64 %iv
17
+ ; CHECK-NEXT: %gep.C = getelementptr inbounds i32, ptr %A, i64 %iv
18
18
; CHECK-NEXT: Against group ([[GRP2:0x[0-9a-f]+]]):
19
- ; CHECK-NEXT: %gep.A.0 = getelementptr inbounds i8, ptr %A, i64 %iv
19
+ ; CHECK-NEXT: %gep.A = getelementptr inbounds i8, ptr %A, i64 %iv.off
20
20
; CHECK-NEXT: Grouped accesses:
21
21
; CHECK-NEXT: Group [[GRP1]]:
22
22
; CHECK-NEXT: (Low: %A High: ((4 * %N) + %A))
23
23
; CHECK-NEXT: Member: {%A,+,4}<nuw><%loop>
24
24
; CHECK-NEXT: Group [[GRP2]]:
25
- ; CHECK-NEXT: (Low: %A High: (%N + %A))
26
- ; CHECK-NEXT: Member: {%A ,+,1}<nuw ><%loop>
25
+ ; CHECK-NEXT: (Low: (%off + %A) High: (%N + %off + %A))
26
+ ; CHECK-NEXT: Member: {(%off + %A) ,+,1}<nw ><%loop>
27
27
; CHECK-EMPTY:
28
28
; CHECK-NEXT: Non vectorizable stores to invariant address were not found in loop.
29
29
; CHECK-NEXT: SCEV assumptions:
@@ -35,15 +35,16 @@ entry:
35
35
36
36
loop:
37
37
%iv = phi i64 [ 0 , %entry ], [ %iv.next , %loop ]
38
- %gep.A.0 = getelementptr inbounds i8 , ptr %A , i64 %iv
39
- %indices = load i8 , ptr %gep.A.0 , align 1
38
+ %iv.off = add nuw nsw i64 %iv , %off
39
+ %gep.A = getelementptr inbounds i8 , ptr %A , i64 %iv.off
40
+ %indices = load i8 , ptr %gep.A , align 1
40
41
%indices.ext = zext i8 %indices to i64
41
42
%gep.B = getelementptr inbounds i32 , ptr %B , i64 %indices.ext
42
43
%l = load i32 , ptr %gep.B , align 4
43
44
%inc = add i32 %l , 1
44
45
store i32 %inc , ptr %gep.B , align 4
45
- %gep.A.1 = getelementptr inbounds i32 , ptr %A , i64 %iv
46
- store i32 %l , ptr %gep.A.1 , align 4
46
+ %gep.C = getelementptr inbounds i32 , ptr %A , i64 %iv
47
+ store i32 %l , ptr %gep.C , align 4
47
48
%iv.next = add nuw nsw i64 %iv , 1
48
49
%ec = icmp eq i64 %iv.next , %N
49
50
br i1 %ec , label %exit , label %loop
77
78
78
79
loop:
79
80
%iv = phi i64 [ 0 , %entry ], [ %iv.next , %loop ]
80
- %gep.A.0 = getelementptr inbounds i8 , ptr %A , i64 %iv
81
- %indices = load i8 , ptr %gep.A.0 , align 1
81
+ %gep.A = getelementptr inbounds i8 , ptr %A , i64 %iv
82
+ %indices = load i8 , ptr %gep.A , align 1
82
83
%indices.ext = zext i8 %indices to i64
83
84
%gep.B = getelementptr inbounds i32 , ptr %B , i64 %indices.ext
84
85
%l = load i32 , ptr %gep.B , align 4
0 commit comments