1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2; Verify that calls to memcmp with arrays of elements larger than char
3; are folded correctly.
4; RUN: opt < %s -passes=instcombine -S -data-layout="E" | FileCheck %s --check-prefixes=BE
5; RUN: opt < %s -passes=instcombine -S -data-layout="e" | FileCheck %s --check-prefixes=LE
6
7declare i32 @memcmp(i8*, i8*, i64)
8
9; BE representation: { 'a', 'b', 'c', ..., 'f', 'g', 'h' }
10; LE representation: { 'b', 'a', 'd', ..., 'e', 'h', 'g' }
11@ia6a = constant [4 x i16] [i16 24930, i16 25444, i16 25958, i16 26472]
12
13; Same as the BE representation above except ending in "gg".
14@i8a = constant [8 x i8] c"abcdefgg"
15
16; Fold memcmp(ia6a, i8a, N) for N in [0, 8].
17
18define void @fold_memcmp_ia6a_i8a(i32* %pcmp) {
19; BE-LABEL: @fold_memcmp_ia6a_i8a(
20; BE-NEXT:    store i32 0, i32* [[PCMP:%.*]], align 4
21; BE-NEXT:    [[PSTOR1:%.*]] = getelementptr i32, i32* [[PCMP]], i64 1
22; BE-NEXT:    store i32 0, i32* [[PSTOR1]], align 4
23; BE-NEXT:    [[CMP2:%.*]] = call i32 @memcmp(i8* noundef nonnull dereferenceable(2) bitcast ([4 x i16]* @ia6a to i8*), i8* noundef nonnull dereferenceable(2) getelementptr inbounds ([8 x i8], [8 x i8]* @i8a, i64 0, i64 0), i64 2)
24; BE-NEXT:    [[PSTOR2:%.*]] = getelementptr i32, i32* [[PCMP]], i64 2
25; BE-NEXT:    store i32 [[CMP2]], i32* [[PSTOR2]], align 4
26; BE-NEXT:    [[CMP3:%.*]] = call i32 @memcmp(i8* noundef nonnull dereferenceable(3) bitcast ([4 x i16]* @ia6a to i8*), i8* noundef nonnull dereferenceable(3) getelementptr inbounds ([8 x i8], [8 x i8]* @i8a, i64 0, i64 0), i64 3)
27; BE-NEXT:    [[PSTOR3:%.*]] = getelementptr i32, i32* [[PCMP]], i64 3
28; BE-NEXT:    store i32 [[CMP3]], i32* [[PSTOR3]], align 4
29; BE-NEXT:    [[CMP4:%.*]] = call i32 @memcmp(i8* noundef nonnull dereferenceable(4) bitcast ([4 x i16]* @ia6a to i8*), i8* noundef nonnull dereferenceable(4) getelementptr inbounds ([8 x i8], [8 x i8]* @i8a, i64 0, i64 0), i64 4)
30; BE-NEXT:    [[PSTOR4:%.*]] = getelementptr i32, i32* [[PCMP]], i64 4
31; BE-NEXT:    store i32 [[CMP4]], i32* [[PSTOR4]], align 4
32; BE-NEXT:    [[CMP5:%.*]] = call i32 @memcmp(i8* noundef nonnull dereferenceable(5) bitcast ([4 x i16]* @ia6a to i8*), i8* noundef nonnull dereferenceable(5) getelementptr inbounds ([8 x i8], [8 x i8]* @i8a, i64 0, i64 0), i64 5)
33; BE-NEXT:    [[PSTOR5:%.*]] = getelementptr i32, i32* [[PCMP]], i64 5
34; BE-NEXT:    store i32 [[CMP5]], i32* [[PSTOR5]], align 4
35; BE-NEXT:    [[CMP6:%.*]] = call i32 @memcmp(i8* noundef nonnull dereferenceable(6) bitcast ([4 x i16]* @ia6a to i8*), i8* noundef nonnull dereferenceable(6) getelementptr inbounds ([8 x i8], [8 x i8]* @i8a, i64 0, i64 0), i64 6)
36; BE-NEXT:    [[PSTOR6:%.*]] = getelementptr i32, i32* [[PCMP]], i64 6
37; BE-NEXT:    store i32 [[CMP6]], i32* [[PSTOR6]], align 4
38; BE-NEXT:    [[CMP7:%.*]] = call i32 @memcmp(i8* noundef nonnull dereferenceable(7) bitcast ([4 x i16]* @ia6a to i8*), i8* noundef nonnull dereferenceable(7) getelementptr inbounds ([8 x i8], [8 x i8]* @i8a, i64 0, i64 0), i64 7)
39; BE-NEXT:    [[PSTOR7:%.*]] = getelementptr i32, i32* [[PCMP]], i64 7
40; BE-NEXT:    store i32 [[CMP7]], i32* [[PSTOR7]], align 4
41; BE-NEXT:    [[CMP8:%.*]] = call i32 @memcmp(i8* noundef nonnull dereferenceable(8) bitcast ([4 x i16]* @ia6a to i8*), i8* noundef nonnull dereferenceable(8) getelementptr inbounds ([8 x i8], [8 x i8]* @i8a, i64 0, i64 0), i64 8)
42; BE-NEXT:    [[PSTOR8:%.*]] = getelementptr i32, i32* [[PCMP]], i64 8
43; BE-NEXT:    store i32 [[CMP8]], i32* [[PSTOR8]], align 4
44; BE-NEXT:    ret void
45;
46; LE-LABEL: @fold_memcmp_ia6a_i8a(
47; LE-NEXT:    store i32 0, i32* [[PCMP:%.*]], align 4
48; LE-NEXT:    [[PSTOR1:%.*]] = getelementptr i32, i32* [[PCMP]], i64 1
49; LE-NEXT:    store i32 1, i32* [[PSTOR1]], align 4
50; LE-NEXT:    [[CMP2:%.*]] = call i32 @memcmp(i8* noundef nonnull dereferenceable(2) bitcast ([4 x i16]* @ia6a to i8*), i8* noundef nonnull dereferenceable(2) getelementptr inbounds ([8 x i8], [8 x i8]* @i8a, i64 0, i64 0), i64 2)
51; LE-NEXT:    [[PSTOR2:%.*]] = getelementptr i32, i32* [[PCMP]], i64 2
52; LE-NEXT:    store i32 [[CMP2]], i32* [[PSTOR2]], align 4
53; LE-NEXT:    [[CMP3:%.*]] = call i32 @memcmp(i8* noundef nonnull dereferenceable(3) bitcast ([4 x i16]* @ia6a to i8*), i8* noundef nonnull dereferenceable(3) getelementptr inbounds ([8 x i8], [8 x i8]* @i8a, i64 0, i64 0), i64 3)
54; LE-NEXT:    [[PSTOR3:%.*]] = getelementptr i32, i32* [[PCMP]], i64 3
55; LE-NEXT:    store i32 [[CMP3]], i32* [[PSTOR3]], align 4
56; LE-NEXT:    [[CMP4:%.*]] = call i32 @memcmp(i8* noundef nonnull dereferenceable(4) bitcast ([4 x i16]* @ia6a to i8*), i8* noundef nonnull dereferenceable(4) getelementptr inbounds ([8 x i8], [8 x i8]* @i8a, i64 0, i64 0), i64 4)
57; LE-NEXT:    [[PSTOR4:%.*]] = getelementptr i32, i32* [[PCMP]], i64 4
58; LE-NEXT:    store i32 [[CMP4]], i32* [[PSTOR4]], align 4
59; LE-NEXT:    [[CMP5:%.*]] = call i32 @memcmp(i8* noundef nonnull dereferenceable(5) bitcast ([4 x i16]* @ia6a to i8*), i8* noundef nonnull dereferenceable(5) getelementptr inbounds ([8 x i8], [8 x i8]* @i8a, i64 0, i64 0), i64 5)
60; LE-NEXT:    [[PSTOR5:%.*]] = getelementptr i32, i32* [[PCMP]], i64 5
61; LE-NEXT:    store i32 [[CMP5]], i32* [[PSTOR5]], align 4
62; LE-NEXT:    [[CMP6:%.*]] = call i32 @memcmp(i8* noundef nonnull dereferenceable(6) bitcast ([4 x i16]* @ia6a to i8*), i8* noundef nonnull dereferenceable(6) getelementptr inbounds ([8 x i8], [8 x i8]* @i8a, i64 0, i64 0), i64 6)
63; LE-NEXT:    [[PSTOR6:%.*]] = getelementptr i32, i32* [[PCMP]], i64 6
64; LE-NEXT:    store i32 [[CMP6]], i32* [[PSTOR6]], align 4
65; LE-NEXT:    [[CMP7:%.*]] = call i32 @memcmp(i8* noundef nonnull dereferenceable(7) bitcast ([4 x i16]* @ia6a to i8*), i8* noundef nonnull dereferenceable(7) getelementptr inbounds ([8 x i8], [8 x i8]* @i8a, i64 0, i64 0), i64 7)
66; LE-NEXT:    [[PSTOR7:%.*]] = getelementptr i32, i32* [[PCMP]], i64 7
67; LE-NEXT:    store i32 [[CMP7]], i32* [[PSTOR7]], align 4
68; LE-NEXT:    [[CMP8:%.*]] = call i32 @memcmp(i8* noundef nonnull dereferenceable(8) bitcast ([4 x i16]* @ia6a to i8*), i8* noundef nonnull dereferenceable(8) getelementptr inbounds ([8 x i8], [8 x i8]* @i8a, i64 0, i64 0), i64 8)
69; LE-NEXT:    [[PSTOR8:%.*]] = getelementptr i32, i32* [[PCMP]], i64 8
70; LE-NEXT:    store i32 [[CMP8]], i32* [[PSTOR8]], align 4
71; LE-NEXT:    ret void
72;
73  %p0 = getelementptr [4 x i16], [4 x i16]* @ia6a, i64 0, i64 0
74  %p1 = bitcast i16* %p0 to i8*
75  %q = getelementptr [8 x i8], [8 x i8]* @i8a, i64 0, i64 0
76
77  %cmp0 = call i32 @memcmp(i8* %p1, i8* %q, i64 0)
78  %pstor0 = getelementptr i32, i32* %pcmp, i64 0
79  store i32 %cmp0, i32* %pstor0
80
81  %cmp1 = call i32 @memcmp(i8* %p1, i8* %q, i64 1)
82  %pstor1 = getelementptr i32, i32* %pcmp, i64 1
83  store i32 %cmp1, i32* %pstor1
84
85  %cmp2 = call i32 @memcmp(i8* %p1, i8* %q, i64 2)
86  %pstor2 = getelementptr i32, i32* %pcmp, i64 2
87  store i32 %cmp2, i32* %pstor2
88
89  %cmp3 = call i32 @memcmp(i8* %p1, i8* %q, i64 3)
90  %pstor3 = getelementptr i32, i32* %pcmp, i64 3
91  store i32 %cmp3, i32* %pstor3
92
93  %cmp4 = call i32 @memcmp(i8* %p1, i8* %q, i64 4)
94  %pstor4 = getelementptr i32, i32* %pcmp, i64 4
95  store i32 %cmp4, i32* %pstor4
96
97  %cmp5 = call i32 @memcmp(i8* %p1, i8* %q, i64 5)
98  %pstor5 = getelementptr i32, i32* %pcmp, i64 5
99  store i32 %cmp5, i32* %pstor5
100
101  %cmp6 = call i32 @memcmp(i8* %p1, i8* %q, i64 6)
102  %pstor6 = getelementptr i32, i32* %pcmp, i64 6
103  store i32 %cmp6, i32* %pstor6
104
105  %cmp7 = call i32 @memcmp(i8* %p1, i8* %q, i64 7)
106  %pstor7 = getelementptr i32, i32* %pcmp, i64 7
107  store i32 %cmp7, i32* %pstor7
108
109  %cmp8 = call i32 @memcmp(i8* %p1, i8* %q, i64 8)
110  %pstor8 = getelementptr i32, i32* %pcmp, i64 8
111  store i32 %cmp8, i32* %pstor8
112
113  ret void
114}
115
116
117; Fold memcmp(ia6a + 1, i8a + 2, N) for N in [0, 6].
118
119define void @fold_memcmp_ia6a_p1_i8a_p1(i32* %pcmp) {
120; BE-LABEL: @fold_memcmp_ia6a_p1_i8a_p1(
121; BE-NEXT:    store i32 0, i32* [[PCMP:%.*]], align 4
122; BE-NEXT:    [[PSTOR1:%.*]] = getelementptr i32, i32* [[PCMP]], i64 1
123; BE-NEXT:    store i32 1, i32* [[PSTOR1]], align 4
124; BE-NEXT:    [[CMP2:%.*]] = call i32 @memcmp(i8* noundef nonnull dereferenceable(2) bitcast (i16* getelementptr inbounds ([4 x i16], [4 x i16]* @ia6a, i64 0, i64 1) to i8*), i8* noundef nonnull dereferenceable(2) getelementptr inbounds ([8 x i8], [8 x i8]* @i8a, i64 0, i64 1), i64 2)
125; BE-NEXT:    [[PSTOR2:%.*]] = getelementptr i32, i32* [[PCMP]], i64 2
126; BE-NEXT:    store i32 [[CMP2]], i32* [[PSTOR2]], align 4
127; BE-NEXT:    [[CMP3:%.*]] = call i32 @memcmp(i8* noundef nonnull dereferenceable(3) bitcast (i16* getelementptr inbounds ([4 x i16], [4 x i16]* @ia6a, i64 0, i64 1) to i8*), i8* noundef nonnull dereferenceable(3) getelementptr inbounds ([8 x i8], [8 x i8]* @i8a, i64 0, i64 1), i64 3)
128; BE-NEXT:    [[PSTOR3:%.*]] = getelementptr i32, i32* [[PCMP]], i64 3
129; BE-NEXT:    store i32 [[CMP3]], i32* [[PSTOR3]], align 4
130; BE-NEXT:    [[CMP4:%.*]] = call i32 @memcmp(i8* noundef nonnull dereferenceable(4) bitcast (i16* getelementptr inbounds ([4 x i16], [4 x i16]* @ia6a, i64 0, i64 1) to i8*), i8* noundef nonnull dereferenceable(4) getelementptr inbounds ([8 x i8], [8 x i8]* @i8a, i64 0, i64 1), i64 4)
131; BE-NEXT:    [[PSTOR4:%.*]] = getelementptr i32, i32* [[PCMP]], i64 4
132; BE-NEXT:    store i32 [[CMP4]], i32* [[PSTOR4]], align 4
133; BE-NEXT:    [[CMP5:%.*]] = call i32 @memcmp(i8* noundef nonnull dereferenceable(5) bitcast (i16* getelementptr inbounds ([4 x i16], [4 x i16]* @ia6a, i64 0, i64 1) to i8*), i8* noundef nonnull dereferenceable(5) getelementptr inbounds ([8 x i8], [8 x i8]* @i8a, i64 0, i64 1), i64 5)
134; BE-NEXT:    [[PSTOR5:%.*]] = getelementptr i32, i32* [[PCMP]], i64 5
135; BE-NEXT:    store i32 [[CMP5]], i32* [[PSTOR5]], align 4
136; BE-NEXT:    [[CMP6:%.*]] = call i32 @memcmp(i8* noundef nonnull dereferenceable(6) bitcast (i16* getelementptr inbounds ([4 x i16], [4 x i16]* @ia6a, i64 0, i64 1) to i8*), i8* noundef nonnull dereferenceable(6) getelementptr inbounds ([8 x i8], [8 x i8]* @i8a, i64 0, i64 1), i64 6)
137; BE-NEXT:    [[PSTOR6:%.*]] = getelementptr i32, i32* [[PCMP]], i64 6
138; BE-NEXT:    store i32 [[CMP6]], i32* [[PSTOR6]], align 4
139; BE-NEXT:    ret void
140;
141; LE-LABEL: @fold_memcmp_ia6a_p1_i8a_p1(
142; LE-NEXT:    store i32 0, i32* [[PCMP:%.*]], align 4
143; LE-NEXT:    [[PSTOR1:%.*]] = getelementptr i32, i32* [[PCMP]], i64 1
144; LE-NEXT:    store i32 2, i32* [[PSTOR1]], align 4
145; LE-NEXT:    [[CMP2:%.*]] = call i32 @memcmp(i8* noundef nonnull dereferenceable(2) bitcast (i16* getelementptr inbounds ([4 x i16], [4 x i16]* @ia6a, i64 0, i64 1) to i8*), i8* noundef nonnull dereferenceable(2) getelementptr inbounds ([8 x i8], [8 x i8]* @i8a, i64 0, i64 1), i64 2)
146; LE-NEXT:    [[PSTOR2:%.*]] = getelementptr i32, i32* [[PCMP]], i64 2
147; LE-NEXT:    store i32 [[CMP2]], i32* [[PSTOR2]], align 4
148; LE-NEXT:    [[CMP3:%.*]] = call i32 @memcmp(i8* noundef nonnull dereferenceable(3) bitcast (i16* getelementptr inbounds ([4 x i16], [4 x i16]* @ia6a, i64 0, i64 1) to i8*), i8* noundef nonnull dereferenceable(3) getelementptr inbounds ([8 x i8], [8 x i8]* @i8a, i64 0, i64 1), i64 3)
149; LE-NEXT:    [[PSTOR3:%.*]] = getelementptr i32, i32* [[PCMP]], i64 3
150; LE-NEXT:    store i32 [[CMP3]], i32* [[PSTOR3]], align 4
151; LE-NEXT:    [[CMP4:%.*]] = call i32 @memcmp(i8* noundef nonnull dereferenceable(4) bitcast (i16* getelementptr inbounds ([4 x i16], [4 x i16]* @ia6a, i64 0, i64 1) to i8*), i8* noundef nonnull dereferenceable(4) getelementptr inbounds ([8 x i8], [8 x i8]* @i8a, i64 0, i64 1), i64 4)
152; LE-NEXT:    [[PSTOR4:%.*]] = getelementptr i32, i32* [[PCMP]], i64 4
153; LE-NEXT:    store i32 [[CMP4]], i32* [[PSTOR4]], align 4
154; LE-NEXT:    [[CMP5:%.*]] = call i32 @memcmp(i8* noundef nonnull dereferenceable(5) bitcast (i16* getelementptr inbounds ([4 x i16], [4 x i16]* @ia6a, i64 0, i64 1) to i8*), i8* noundef nonnull dereferenceable(5) getelementptr inbounds ([8 x i8], [8 x i8]* @i8a, i64 0, i64 1), i64 5)
155; LE-NEXT:    [[PSTOR5:%.*]] = getelementptr i32, i32* [[PCMP]], i64 5
156; LE-NEXT:    store i32 [[CMP5]], i32* [[PSTOR5]], align 4
157; LE-NEXT:    [[CMP6:%.*]] = call i32 @memcmp(i8* noundef nonnull dereferenceable(6) bitcast (i16* getelementptr inbounds ([4 x i16], [4 x i16]* @ia6a, i64 0, i64 1) to i8*), i8* noundef nonnull dereferenceable(6) getelementptr inbounds ([8 x i8], [8 x i8]* @i8a, i64 0, i64 1), i64 6)
158; LE-NEXT:    [[PSTOR6:%.*]] = getelementptr i32, i32* [[PCMP]], i64 6
159; LE-NEXT:    store i32 [[CMP6]], i32* [[PSTOR6]], align 4
160; LE-NEXT:    ret void
161;
162  %p0 = getelementptr [4 x i16], [4 x i16]* @ia6a, i64 0, i64 1
163  %p1 = bitcast i16* %p0 to i8*
164  %q = getelementptr [8 x i8], [8 x i8]* @i8a, i64 0, i64 1
165
166  %cmp0 = call i32 @memcmp(i8* %p1, i8* %q, i64 0)
167  %pstor0 = getelementptr i32, i32* %pcmp, i64 0
168  store i32 %cmp0, i32* %pstor0
169
170  %cmp1 = call i32 @memcmp(i8* %p1, i8* %q, i64 1)
171  %pstor1 = getelementptr i32, i32* %pcmp, i64 1
172  store i32 %cmp1, i32* %pstor1
173
174  %cmp2 = call i32 @memcmp(i8* %p1, i8* %q, i64 2)
175  %pstor2 = getelementptr i32, i32* %pcmp, i64 2
176  store i32 %cmp2, i32* %pstor2
177
178  %cmp3 = call i32 @memcmp(i8* %p1, i8* %q, i64 3)
179  %pstor3 = getelementptr i32, i32* %pcmp, i64 3
180  store i32 %cmp3, i32* %pstor3
181
182  %cmp4 = call i32 @memcmp(i8* %p1, i8* %q, i64 4)
183  %pstor4 = getelementptr i32, i32* %pcmp, i64 4
184  store i32 %cmp4, i32* %pstor4
185
186  %cmp5 = call i32 @memcmp(i8* %p1, i8* %q, i64 5)
187  %pstor5 = getelementptr i32, i32* %pcmp, i64 5
188  store i32 %cmp5, i32* %pstor5
189
190  %cmp6 = call i32 @memcmp(i8* %p1, i8* %q, i64 6)
191  %pstor6 = getelementptr i32, i32* %pcmp, i64 6
192  store i32 %cmp6, i32* %pstor6
193
194  ret void
195}
196
197
198; Don't fold calls with excessive sizes.
199
200define void @call_memcmp_too_big(i32* %pcmp) {
201; BE-LABEL: @call_memcmp_too_big(
202; BE-NEXT:    [[CMP9:%.*]] = call i32 @memcmp(i8* noundef nonnull dereferenceable(9) bitcast ([4 x i16]* @ia6a to i8*), i8* noundef nonnull dereferenceable(9) getelementptr inbounds ([8 x i8], [8 x i8]* @i8a, i64 0, i64 0), i64 9)
203; BE-NEXT:    store i32 [[CMP9]], i32* [[PCMP:%.*]], align 4
204; BE-NEXT:    [[CMPM1:%.*]] = call i32 @memcmp(i8* noundef nonnull dereferenceable(18446744073709551615) bitcast ([4 x i16]* @ia6a to i8*), i8* noundef nonnull dereferenceable(18446744073709551615) getelementptr inbounds ([8 x i8], [8 x i8]* @i8a, i64 0, i64 0), i64 -1)
205; BE-NEXT:    [[PSTORM1:%.*]] = getelementptr i32, i32* [[PCMP]], i64 1
206; BE-NEXT:    store i32 [[CMPM1]], i32* [[PSTORM1]], align 4
207; BE-NEXT:    [[CMPX2:%.*]] = call i32 @memcmp(i8* noundef nonnull dereferenceable(8) bitcast ([4 x i16]* @ia6a to i8*), i8* noundef nonnull dereferenceable(8) getelementptr inbounds ([8 x i8], [8 x i8]* @i8a, i64 0, i64 1), i64 8)
208; BE-NEXT:    [[PSTORX2:%.*]] = getelementptr i32, i32* [[PCMP]], i64 2
209; BE-NEXT:    store i32 [[CMPX2]], i32* [[PSTORX2]], align 4
210; BE-NEXT:    [[CMPX1:%.*]] = call i32 @memcmp(i8* noundef nonnull dereferenceable(8) getelementptr (i8, i8* bitcast ([4 x i16]* @ia6a to i8*), i64 1), i8* noundef nonnull dereferenceable(8) getelementptr inbounds ([8 x i8], [8 x i8]* @i8a, i64 0, i64 0), i64 8)
211; BE-NEXT:    [[PSTORX1:%.*]] = getelementptr i32, i32* [[PCMP]], i64 2
212; BE-NEXT:    store i32 [[CMPX1]], i32* [[PSTORX1]], align 4
213; BE-NEXT:    ret void
214;
215; LE-LABEL: @call_memcmp_too_big(
216; LE-NEXT:    [[CMP9:%.*]] = call i32 @memcmp(i8* noundef nonnull dereferenceable(9) bitcast ([4 x i16]* @ia6a to i8*), i8* noundef nonnull dereferenceable(9) getelementptr inbounds ([8 x i8], [8 x i8]* @i8a, i64 0, i64 0), i64 9)
217; LE-NEXT:    store i32 [[CMP9]], i32* [[PCMP:%.*]], align 4
218; LE-NEXT:    [[CMPM1:%.*]] = call i32 @memcmp(i8* noundef nonnull dereferenceable(18446744073709551615) bitcast ([4 x i16]* @ia6a to i8*), i8* noundef nonnull dereferenceable(18446744073709551615) getelementptr inbounds ([8 x i8], [8 x i8]* @i8a, i64 0, i64 0), i64 -1)
219; LE-NEXT:    [[PSTORM1:%.*]] = getelementptr i32, i32* [[PCMP]], i64 1
220; LE-NEXT:    store i32 [[CMPM1]], i32* [[PSTORM1]], align 4
221; LE-NEXT:    [[CMPX2:%.*]] = call i32 @memcmp(i8* noundef nonnull dereferenceable(8) bitcast ([4 x i16]* @ia6a to i8*), i8* noundef nonnull dereferenceable(8) getelementptr inbounds ([8 x i8], [8 x i8]* @i8a, i64 0, i64 1), i64 8)
222; LE-NEXT:    [[PSTORX2:%.*]] = getelementptr i32, i32* [[PCMP]], i64 2
223; LE-NEXT:    store i32 [[CMPX2]], i32* [[PSTORX2]], align 4
224; LE-NEXT:    [[CMPX1:%.*]] = call i32 @memcmp(i8* noundef nonnull dereferenceable(8) getelementptr (i8, i8* bitcast ([4 x i16]* @ia6a to i8*), i64 1), i8* noundef nonnull dereferenceable(8) getelementptr inbounds ([8 x i8], [8 x i8]* @i8a, i64 0, i64 0), i64 8)
225; LE-NEXT:    [[PSTORX1:%.*]] = getelementptr i32, i32* [[PCMP]], i64 2
226; LE-NEXT:    store i32 [[CMPX1]], i32* [[PSTORX1]], align 4
227; LE-NEXT:    ret void
228;
229  %p0 = getelementptr [4 x i16], [4 x i16]* @ia6a, i64 0, i64 0
230  %p1 = bitcast i16* %p0 to i8*
231  %q = getelementptr [8 x i8], [8 x i8]* @i8a, i64 0, i64 0
232
233  %cmp9 = call i32 @memcmp(i8* %p1, i8* %q, i64 9)
234  %pstor9 = getelementptr i32, i32* %pcmp, i64 0
235  store i32 %cmp9, i32* %pstor9
236
237  %cmpm1 = call i32 @memcmp(i8* %p1, i8* %q, i64 -1)
238  %pstorm1 = getelementptr i32, i32* %pcmp, i64 1
239  store i32 %cmpm1, i32* %pstorm1
240
241  ; Exercise size that's greater than just one of the arrays.
242  %q2 = getelementptr [8 x i8], [8 x i8]* @i8a, i64 0, i64 1
243  %cmpx2 = call i32 @memcmp(i8* %p1, i8* %q2, i64 8)
244  %pstorx2 = getelementptr i32, i32* %pcmp, i64 2
245  store i32 %cmpx2, i32* %pstorx2
246
247  %p2 = getelementptr i8, i8* %p1, i64 1
248  %cmpx1 = call i32 @memcmp(i8* %p2, i8* %q, i64 8)
249  %pstorx1 = getelementptr i32, i32* %pcmp, i64 2
250  store i32 %cmpx1, i32* %pstorx1
251
252  ret void
253}
254