1 ; NOTE: Assertions have been autogenerated by utils/update_analyze_test_checks.py UTC_ARGS: --version 5
2 ; RUN: opt -passes='print<access-info>' -disable-output %s 2>&1 | FileCheck %s
4 target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
6 define void @loads_of_same_pointer_with_different_sizes1(ptr %A, ptr %B, i64 %N) {
7 ; CHECK-LABEL: 'loads_of_same_pointer_with_different_sizes1'
9 ; CHECK-NEXT: Memory dependences are safe with run-time checks
10 ; CHECK-NEXT: Dependences:
11 ; CHECK-NEXT: Run-time memory checks:
12 ; CHECK-NEXT: Check 0:
13 ; CHECK-NEXT: Comparing group ([[GRP1:0x[0-9a-f]+]]):
14 ; CHECK-NEXT: %gep.B = getelementptr inbounds i32, ptr %B, i64 %iv
15 ; CHECK-NEXT: Against group ([[GRP2:0x[0-9a-f]+]]):
16 ; CHECK-NEXT: %gep.A = getelementptr inbounds i8, ptr %A, i64 %iv
17 ; CHECK-NEXT: %gep.A = getelementptr inbounds i8, ptr %A, i64 %iv
18 ; CHECK-NEXT: Grouped accesses:
19 ; CHECK-NEXT: Group [[GRP1]]:
20 ; CHECK-NEXT: (Low: %B High: ((4 * %N) + %B))
21 ; CHECK-NEXT: Member: {%B,+,4}<nuw><%loop>
22 ; CHECK-NEXT: Group [[GRP2]]:
23 ; CHECK-NEXT: (Low: %A High: (3 + %N + %A))
24 ; CHECK-NEXT: Member: {%A,+,1}<nuw><%loop>
25 ; CHECK-NEXT: Member: {%A,+,1}<nuw><%loop>
27 ; CHECK-NEXT: Non vectorizable stores to invariant address were not found in loop.
28 ; CHECK-NEXT: SCEV assumptions:
30 ; CHECK-NEXT: Expressions re-written:
36 %iv = phi i64 [ 0, %entry ], [ %iv.next, %loop ]
37 %gep.A = getelementptr inbounds i8, ptr %A, i64 %iv
38 %l0 = load i8, ptr %gep.A, align 1
39 %l1 = load i32, ptr %gep.A, align 1
40 %l0.ext = sext i8 %l0 to i32
41 %iv.trunc = trunc nuw i64 %iv to i32
42 %sub.0 = sub i32 %l0.ext, %iv.trunc
43 %sub.1 = sub i32 %l1, %sub.0
44 %gep.B = getelementptr inbounds i32, ptr %B, i64 %iv
45 store i32 %sub.1, ptr %gep.B, align 4
46 %iv.next = add nuw nsw i64 %iv, 1
47 %exitcond.not = icmp eq i64 %iv.next, %N
48 br i1 %exitcond.not, label %exit, label %loop
54 define void @loads_of_same_pointer_with_different_sizes2(ptr %A, ptr %B, i64 %N) {
55 ; CHECK-LABEL: 'loads_of_same_pointer_with_different_sizes2'
57 ; CHECK-NEXT: Memory dependences are safe with run-time checks
58 ; CHECK-NEXT: Dependences:
59 ; CHECK-NEXT: Run-time memory checks:
60 ; CHECK-NEXT: Check 0:
61 ; CHECK-NEXT: Comparing group ([[GRP3:0x[0-9a-f]+]]):
62 ; CHECK-NEXT: %gep.B = getelementptr inbounds i32, ptr %B, i64 %iv
63 ; CHECK-NEXT: Against group ([[GRP4:0x[0-9a-f]+]]):
64 ; CHECK-NEXT: %gep.A = getelementptr inbounds i8, ptr %A, i64 %iv
65 ; CHECK-NEXT: %gep.A = getelementptr inbounds i8, ptr %A, i64 %iv
66 ; CHECK-NEXT: Grouped accesses:
67 ; CHECK-NEXT: Group [[GRP3]]:
68 ; CHECK-NEXT: (Low: %B High: ((4 * %N) + %B))
69 ; CHECK-NEXT: Member: {%B,+,4}<nuw><%loop>
70 ; CHECK-NEXT: Group [[GRP4]]:
71 ; CHECK-NEXT: (Low: %A High: (3 + %N + %A))
72 ; CHECK-NEXT: Member: {%A,+,1}<nuw><%loop>
73 ; CHECK-NEXT: Member: {%A,+,1}<nuw><%loop>
75 ; CHECK-NEXT: Non vectorizable stores to invariant address were not found in loop.
76 ; CHECK-NEXT: SCEV assumptions:
78 ; CHECK-NEXT: Expressions re-written:
84 %iv = phi i64 [ 0, %entry ], [ %iv.next, %loop ]
85 %gep.A = getelementptr inbounds i8, ptr %A, i64 %iv
86 %l1 = load i32, ptr %gep.A, align 1
87 %l0 = load i8, ptr %gep.A, align 1
88 %l0.ext = sext i8 %l0 to i32
89 %iv.trunc = trunc nuw i64 %iv to i32
90 %sub.0 = sub i32 %l0.ext, %iv.trunc
91 %sub.1 = sub i32 %l1, %sub.0
92 %gep.B = getelementptr inbounds i32, ptr %B, i64 %iv
93 store i32 %sub.1, ptr %gep.B, align 4
94 %iv.next = add nuw nsw i64 %iv, 1
95 %exitcond.not = icmp eq i64 %iv.next, %N
96 br i1 %exitcond.not, label %exit, label %loop
102 define void @loads_of_same_pointer_with_different_sizes_retry_with_runtime_checks(ptr %A, ptr %B, i64 %N, i64 %off) {
103 ; CHECK-LABEL: 'loads_of_same_pointer_with_different_sizes_retry_with_runtime_checks'
105 ; CHECK-NEXT: Memory dependences are safe with run-time checks
106 ; CHECK-NEXT: Dependences:
107 ; CHECK-NEXT: Run-time memory checks:
108 ; CHECK-NEXT: Check 0:
109 ; CHECK-NEXT: Comparing group ([[GRP5:0x[0-9a-f]+]]):
110 ; CHECK-NEXT: %gep.B.iv = getelementptr inbounds i32, ptr %B, i64 %iv
111 ; CHECK-NEXT: Against group ([[GRP6:0x[0-9a-f]+]]):
112 ; CHECK-NEXT: %gep.B.inc = getelementptr inbounds i32, ptr %B, i64 %inc
113 ; CHECK-NEXT: Check 1:
114 ; CHECK-NEXT: Comparing group ([[GRP5]]):
115 ; CHECK-NEXT: %gep.B.iv = getelementptr inbounds i32, ptr %B, i64 %iv
116 ; CHECK-NEXT: Against group ([[GRP7:0x[0-9a-f]+]]):
117 ; CHECK-NEXT: %gep.A = getelementptr inbounds i8, ptr %A, i64 %iv
118 ; CHECK-NEXT: Check 2:
119 ; CHECK-NEXT: Comparing group ([[GRP5]]):
120 ; CHECK-NEXT: %gep.B.iv = getelementptr inbounds i32, ptr %B, i64 %iv
121 ; CHECK-NEXT: Against group ([[GRP8:0x[0-9a-f]+]]):
122 ; CHECK-NEXT: %gep.A = getelementptr inbounds i8, ptr %A, i64 %iv
123 ; CHECK-NEXT: Check 3:
124 ; CHECK-NEXT: Comparing group ([[GRP6]]):
125 ; CHECK-NEXT: %gep.B.inc = getelementptr inbounds i32, ptr %B, i64 %inc
126 ; CHECK-NEXT: Against group ([[GRP7]]):
127 ; CHECK-NEXT: %gep.A = getelementptr inbounds i8, ptr %A, i64 %iv
128 ; CHECK-NEXT: Check 4:
129 ; CHECK-NEXT: Comparing group ([[GRP6]]):
130 ; CHECK-NEXT: %gep.B.inc = getelementptr inbounds i32, ptr %B, i64 %inc
131 ; CHECK-NEXT: Against group ([[GRP8]]):
132 ; CHECK-NEXT: %gep.A = getelementptr inbounds i8, ptr %A, i64 %iv
133 ; CHECK-NEXT: Grouped accesses:
134 ; CHECK-NEXT: Group [[GRP5]]:
135 ; CHECK-NEXT: (Low: %B High: ((4 * %N) + %B))
136 ; CHECK-NEXT: Member: {%B,+,4}<nuw><%loop>
137 ; CHECK-NEXT: Group [[GRP6]]:
138 ; CHECK-NEXT: (Low: ((4 * %off) + %B) High: ((4 * %N) + (4 * %off) + %B))
139 ; CHECK-NEXT: Member: {((4 * %off) + %B),+,4}<%loop>
140 ; CHECK-NEXT: Group [[GRP7]]:
141 ; CHECK-NEXT: (Low: %A High: (%N + %A))
142 ; CHECK-NEXT: Member: {%A,+,1}<nuw><%loop>
143 ; CHECK-NEXT: Group [[GRP8]]:
144 ; CHECK-NEXT: (Low: %A High: (3 + %N + %A))
145 ; CHECK-NEXT: Member: {%A,+,1}<nuw><%loop>
147 ; CHECK-NEXT: Non vectorizable stores to invariant address were not found in loop.
148 ; CHECK-NEXT: SCEV assumptions:
150 ; CHECK-NEXT: Expressions re-written:
156 %iv = phi i64 [ 0, %entry ], [ %iv.next, %loop ]
157 %gep.A = getelementptr inbounds i8, ptr %A, i64 %iv
158 %l0 = load i8, ptr %gep.A, align 1
159 %l1 = load i32, ptr %gep.A, align 1
160 %l0.ext = sext i8 %l0 to i32
161 %iv.trunc = trunc nuw i64 %iv to i32
162 %sub.0 = sub i32 %l0.ext, %iv.trunc
163 %sub.1 = sub i32 %l1, %iv.trunc
164 %gep.B.iv = getelementptr inbounds i32, ptr %B, i64 %iv
165 store i32 %sub.0, ptr %gep.B.iv, align 4
166 %inc = add nuw nsw i64 %iv, %off
167 %gep.B.inc = getelementptr inbounds i32, ptr %B, i64 %inc
168 store i32 %sub.1, ptr %gep.B.inc , align 4
169 %iv.next = add nuw nsw i64 %iv, 1
170 %exitcond.not = icmp eq i64 %iv.next, %N
171 br i1 %exitcond.not, label %exit, label %loop