66; same indices could be loaded in later iterations.
77; FIXME: currently this is incorrectly considered safe for vectorization with
88; 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 ) {
1010; CHECK-LABEL: 'B_indices_loaded_in_loop_A_stored'
1111; CHECK-NEXT: loop:
1212; CHECK-NEXT: Memory dependences are safe with run-time checks
1313; CHECK-NEXT: Dependences:
1414; CHECK-NEXT: Run-time memory checks:
1515; CHECK-NEXT: Check 0:
1616; 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
1818; 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
2020; CHECK-NEXT: Grouped accesses:
2121; CHECK-NEXT: Group [[GRP1]]:
2222; CHECK-NEXT: (Low: %A High: ((4 * %N) + %A))
2323; CHECK-NEXT: Member: {%A,+,4}<nuw><%loop>
2424; 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>
2727; CHECK-EMPTY:
2828; CHECK-NEXT: Non vectorizable stores to invariant address were not found in loop.
2929; CHECK-NEXT: SCEV assumptions:
@@ -35,15 +35,16 @@ entry:
3535
3636loop:
3737 %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
4041 %indices.ext = zext i8 %indices to i64
4142 %gep.B = getelementptr inbounds i32 , ptr %B , i64 %indices.ext
4243 %l = load i32 , ptr %gep.B , align 4
4344 %inc = add i32 %l , 1
4445 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
4748 %iv.next = add nuw nsw i64 %iv , 1
4849 %ec = icmp eq i64 %iv.next , %N
4950 br i1 %ec , label %exit , label %loop
7778
7879loop:
7980 %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
8283 %indices.ext = zext i8 %indices to i64
8384 %gep.B = getelementptr inbounds i32 , ptr %B , i64 %indices.ext
8485 %l = load i32 , ptr %gep.B , align 4
0 commit comments