1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; This test verifies that the loop vectorizer will NOT vectorize loops that
3 ; will produce a tail loop with the optimize for size or the minimize size
4 ; attributes. This is a target-dependent version of the test.
5 ; RUN: opt < %s -loop-vectorize -force-vector-width=64 -S -mtriple=x86_64-unknown-linux -mcpu=skx | FileCheck %s
6 ; RUN: opt < %s -loop-vectorize -S -mtriple=x86_64-unknown-linux -mcpu=skx | FileCheck %s --check-prefix AUTOVF
8 target datalayout = "E-m:e-p:32:32-i64:32-f64:32:64-a:0:32-n32-S128"
10 @tab = common global [32 x i8] zeroinitializer, align 1
12 define i32 @foo_optsize() #0 {
13 ; CHECK-LABEL: @foo_optsize(
15 ; CHECK-NEXT: br i1 false, label [[SCALAR_PH:%.*]], label [[VECTOR_PH:%.*]]
17 ; CHECK-NEXT: br label [[VECTOR_BODY:%.*]]
19 ; CHECK-NEXT: [[INDEX:%.*]] = phi i32 [ 0, [[VECTOR_PH]] ], [ [[INDEX_NEXT:%.*]], [[VECTOR_BODY]] ]
20 ; CHECK-NEXT: [[BROADCAST_SPLATINSERT:%.*]] = insertelement <64 x i32> poison, i32 [[INDEX]], i32 0
21 ; CHECK-NEXT: [[BROADCAST_SPLAT:%.*]] = shufflevector <64 x i32> [[BROADCAST_SPLATINSERT]], <64 x i32> poison, <64 x i32> zeroinitializer
22 ; CHECK-NEXT: [[INDUCTION:%.*]] = add <64 x i32> [[BROADCAST_SPLAT]], <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15, i32 16, i32 17, i32 18, i32 19, i32 20, i32 21, i32 22, i32 23, i32 24, i32 25, i32 26, i32 27, i32 28, i32 29, i32 30, i32 31, i32 32, i32 33, i32 34, i32 35, i32 36, i32 37, i32 38, i32 39, i32 40, i32 41, i32 42, i32 43, i32 44, i32 45, i32 46, i32 47, i32 48, i32 49, i32 50, i32 51, i32 52, i32 53, i32 54, i32 55, i32 56, i32 57, i32 58, i32 59, i32 60, i32 61, i32 62, i32 63>
23 ; CHECK-NEXT: [[TMP0:%.*]] = add i32 [[INDEX]], 0
24 ; CHECK-NEXT: [[TMP1:%.*]] = icmp ule <64 x i32> [[INDUCTION]], <i32 202, i32 202, i32 202, i32 202, i32 202, i32 202, i32 202, i32 202, i32 202, i32 202, i32 202, i32 202, i32 202, i32 202, i32 202, i32 202, i32 202, i32 202, i32 202, i32 202, i32 202, i32 202, i32 202, i32 202, i32 202, i32 202, i32 202, i32 202, i32 202, i32 202, i32 202, i32 202, i32 202, i32 202, i32 202, i32 202, i32 202, i32 202, i32 202, i32 202, i32 202, i32 202, i32 202, i32 202, i32 202, i32 202, i32 202, i32 202, i32 202, i32 202, i32 202, i32 202, i32 202, i32 202, i32 202, i32 202, i32 202, i32 202, i32 202, i32 202, i32 202, i32 202, i32 202, i32 202>
25 ; CHECK-NEXT: [[TMP2:%.*]] = getelementptr inbounds [32 x i8], [32 x i8]* @tab, i32 0, i32 [[TMP0]]
26 ; CHECK-NEXT: [[TMP3:%.*]] = getelementptr inbounds i8, i8* [[TMP2]], i32 0
27 ; CHECK-NEXT: [[TMP4:%.*]] = bitcast i8* [[TMP3]] to <64 x i8>*
28 ; CHECK-NEXT: [[WIDE_MASKED_LOAD:%.*]] = call <64 x i8> @llvm.masked.load.v64i8.p0v64i8(<64 x i8>* [[TMP4]], i32 1, <64 x i1> [[TMP1]], <64 x i8> poison)
29 ; CHECK-NEXT: [[TMP5:%.*]] = icmp eq <64 x i8> [[WIDE_MASKED_LOAD]], zeroinitializer
30 ; CHECK-NEXT: [[TMP6:%.*]] = select <64 x i1> [[TMP5]], <64 x i8> <i8 2, i8 2, i8 2, i8 2, i8 2, i8 2, i8 2, i8 2, i8 2, i8 2, i8 2, i8 2, i8 2, i8 2, i8 2, i8 2, i8 2, i8 2, i8 2, i8 2, i8 2, i8 2, i8 2, i8 2, i8 2, i8 2, i8 2, i8 2, i8 2, i8 2, i8 2, i8 2, i8 2, i8 2, i8 2, i8 2, i8 2, i8 2, i8 2, i8 2, i8 2, i8 2, i8 2, i8 2, i8 2, i8 2, i8 2, i8 2, i8 2, i8 2, i8 2, i8 2, i8 2, i8 2, i8 2, i8 2, i8 2, i8 2, i8 2, i8 2, i8 2, i8 2, i8 2, i8 2>, <64 x i8> <i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1>
31 ; CHECK-NEXT: [[TMP7:%.*]] = bitcast i8* [[TMP3]] to <64 x i8>*
32 ; CHECK-NEXT: call void @llvm.masked.store.v64i8.p0v64i8(<64 x i8> [[TMP6]], <64 x i8>* [[TMP7]], i32 1, <64 x i1> [[TMP1]])
33 ; CHECK-NEXT: [[INDEX_NEXT]] = add i32 [[INDEX]], 64
34 ; CHECK-NEXT: [[TMP8:%.*]] = icmp eq i32 [[INDEX_NEXT]], 256
35 ; CHECK-NEXT: br i1 [[TMP8]], label [[MIDDLE_BLOCK:%.*]], label [[VECTOR_BODY]], [[LOOP0:!llvm.loop !.*]]
36 ; CHECK: middle.block:
37 ; CHECK-NEXT: br i1 true, label [[FOR_END:%.*]], label [[SCALAR_PH]]
39 ; CHECK-NEXT: [[BC_RESUME_VAL:%.*]] = phi i32 [ 256, [[MIDDLE_BLOCK]] ], [ 0, [[ENTRY:%.*]] ]
40 ; CHECK-NEXT: br label [[FOR_BODY:%.*]]
42 ; CHECK-NEXT: [[I_08:%.*]] = phi i32 [ [[BC_RESUME_VAL]], [[SCALAR_PH]] ], [ [[INC:%.*]], [[FOR_BODY]] ]
43 ; CHECK-NEXT: [[ARRAYIDX:%.*]] = getelementptr inbounds [32 x i8], [32 x i8]* @tab, i32 0, i32 [[I_08]]
44 ; CHECK-NEXT: [[TMP9:%.*]] = load i8, i8* [[ARRAYIDX]], align 1
45 ; CHECK-NEXT: [[CMP1:%.*]] = icmp eq i8 [[TMP9]], 0
46 ; CHECK-NEXT: [[DOT:%.*]] = select i1 [[CMP1]], i8 2, i8 1
47 ; CHECK-NEXT: store i8 [[DOT]], i8* [[ARRAYIDX]], align 1
48 ; CHECK-NEXT: [[INC]] = add nsw i32 [[I_08]], 1
49 ; CHECK-NEXT: [[EXITCOND:%.*]] = icmp eq i32 [[I_08]], 202
50 ; CHECK-NEXT: br i1 [[EXITCOND]], label [[FOR_END]], label [[FOR_BODY]], [[LOOP2:!llvm.loop !.*]]
52 ; CHECK-NEXT: ret i32 0
54 ; AUTOVF-LABEL: @foo_optsize(
56 ; AUTOVF-NEXT: br i1 false, label [[SCALAR_PH:%.*]], label [[VECTOR_PH:%.*]]
58 ; AUTOVF-NEXT: br label [[VECTOR_BODY:%.*]]
59 ; AUTOVF: vector.body:
60 ; AUTOVF-NEXT: [[INDEX:%.*]] = phi i32 [ 0, [[VECTOR_PH]] ], [ [[INDEX_NEXT:%.*]], [[VECTOR_BODY]] ]
61 ; AUTOVF-NEXT: [[BROADCAST_SPLATINSERT:%.*]] = insertelement <32 x i32> poison, i32 [[INDEX]], i32 0
62 ; AUTOVF-NEXT: [[BROADCAST_SPLAT:%.*]] = shufflevector <32 x i32> [[BROADCAST_SPLATINSERT]], <32 x i32> poison, <32 x i32> zeroinitializer
63 ; AUTOVF-NEXT: [[INDUCTION:%.*]] = add <32 x i32> [[BROADCAST_SPLAT]], <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15, i32 16, i32 17, i32 18, i32 19, i32 20, i32 21, i32 22, i32 23, i32 24, i32 25, i32 26, i32 27, i32 28, i32 29, i32 30, i32 31>
64 ; AUTOVF-NEXT: [[TMP0:%.*]] = add i32 [[INDEX]], 0
65 ; AUTOVF-NEXT: [[TMP1:%.*]] = icmp ule <32 x i32> [[INDUCTION]], <i32 202, i32 202, i32 202, i32 202, i32 202, i32 202, i32 202, i32 202, i32 202, i32 202, i32 202, i32 202, i32 202, i32 202, i32 202, i32 202, i32 202, i32 202, i32 202, i32 202, i32 202, i32 202, i32 202, i32 202, i32 202, i32 202, i32 202, i32 202, i32 202, i32 202, i32 202, i32 202>
66 ; AUTOVF-NEXT: [[TMP2:%.*]] = getelementptr inbounds [32 x i8], [32 x i8]* @tab, i32 0, i32 [[TMP0]]
67 ; AUTOVF-NEXT: [[TMP3:%.*]] = getelementptr inbounds i8, i8* [[TMP2]], i32 0
68 ; AUTOVF-NEXT: [[TMP4:%.*]] = bitcast i8* [[TMP3]] to <32 x i8>*
69 ; AUTOVF-NEXT: [[WIDE_MASKED_LOAD:%.*]] = call <32 x i8> @llvm.masked.load.v32i8.p0v32i8(<32 x i8>* [[TMP4]], i32 1, <32 x i1> [[TMP1]], <32 x i8> poison)
70 ; AUTOVF-NEXT: [[TMP5:%.*]] = icmp eq <32 x i8> [[WIDE_MASKED_LOAD]], zeroinitializer
71 ; AUTOVF-NEXT: [[TMP6:%.*]] = select <32 x i1> [[TMP5]], <32 x i8> <i8 2, i8 2, i8 2, i8 2, i8 2, i8 2, i8 2, i8 2, i8 2, i8 2, i8 2, i8 2, i8 2, i8 2, i8 2, i8 2, i8 2, i8 2, i8 2, i8 2, i8 2, i8 2, i8 2, i8 2, i8 2, i8 2, i8 2, i8 2, i8 2, i8 2, i8 2, i8 2>, <32 x i8> <i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1>
72 ; AUTOVF-NEXT: [[TMP7:%.*]] = bitcast i8* [[TMP3]] to <32 x i8>*
73 ; AUTOVF-NEXT: call void @llvm.masked.store.v32i8.p0v32i8(<32 x i8> [[TMP6]], <32 x i8>* [[TMP7]], i32 1, <32 x i1> [[TMP1]])
74 ; AUTOVF-NEXT: [[INDEX_NEXT]] = add i32 [[INDEX]], 32
75 ; AUTOVF-NEXT: [[TMP8:%.*]] = icmp eq i32 [[INDEX_NEXT]], 224
76 ; AUTOVF-NEXT: br i1 [[TMP8]], label [[MIDDLE_BLOCK:%.*]], label [[VECTOR_BODY]], [[LOOP0:!llvm.loop !.*]]
77 ; AUTOVF: middle.block:
78 ; AUTOVF-NEXT: br i1 true, label [[FOR_END:%.*]], label [[SCALAR_PH]]
80 ; AUTOVF-NEXT: [[BC_RESUME_VAL:%.*]] = phi i32 [ 224, [[MIDDLE_BLOCK]] ], [ 0, [[ENTRY:%.*]] ]
81 ; AUTOVF-NEXT: br label [[FOR_BODY:%.*]]
83 ; AUTOVF-NEXT: [[I_08:%.*]] = phi i32 [ [[BC_RESUME_VAL]], [[SCALAR_PH]] ], [ [[INC:%.*]], [[FOR_BODY]] ]
84 ; AUTOVF-NEXT: [[ARRAYIDX:%.*]] = getelementptr inbounds [32 x i8], [32 x i8]* @tab, i32 0, i32 [[I_08]]
85 ; AUTOVF-NEXT: [[TMP9:%.*]] = load i8, i8* [[ARRAYIDX]], align 1
86 ; AUTOVF-NEXT: [[CMP1:%.*]] = icmp eq i8 [[TMP9]], 0
87 ; AUTOVF-NEXT: [[DOT:%.*]] = select i1 [[CMP1]], i8 2, i8 1
88 ; AUTOVF-NEXT: store i8 [[DOT]], i8* [[ARRAYIDX]], align 1
89 ; AUTOVF-NEXT: [[INC]] = add nsw i32 [[I_08]], 1
90 ; AUTOVF-NEXT: [[EXITCOND:%.*]] = icmp eq i32 [[I_08]], 202
91 ; AUTOVF-NEXT: br i1 [[EXITCOND]], label [[FOR_END]], label [[FOR_BODY]], [[LOOP2:!llvm.loop !.*]]
93 ; AUTOVF-NEXT: ret i32 0
99 for.body: ; preds = %for.body, %entry
100 %i.08 = phi i32 [ 0, %entry ], [ %inc, %for.body ]
101 %arrayidx = getelementptr inbounds [32 x i8], [32 x i8]* @tab, i32 0, i32 %i.08
102 %0 = load i8, i8* %arrayidx, align 1
103 %cmp1 = icmp eq i8 %0, 0
104 %. = select i1 %cmp1, i8 2, i8 1
105 store i8 %., i8* %arrayidx, align 1
106 %inc = add nsw i32 %i.08, 1
107 %exitcond = icmp eq i32 %i.08, 202
108 br i1 %exitcond, label %for.end, label %for.body
110 for.end: ; preds = %for.body
114 attributes #0 = { optsize }
116 define i32 @foo_minsize() #1 {
117 ; CHECK-LABEL: @foo_minsize(
119 ; CHECK-NEXT: br i1 false, label [[SCALAR_PH:%.*]], label [[VECTOR_PH:%.*]]
121 ; CHECK-NEXT: br label [[VECTOR_BODY:%.*]]
122 ; CHECK: vector.body:
123 ; CHECK-NEXT: [[INDEX:%.*]] = phi i32 [ 0, [[VECTOR_PH]] ], [ [[INDEX_NEXT:%.*]], [[VECTOR_BODY]] ]
124 ; CHECK-NEXT: [[BROADCAST_SPLATINSERT:%.*]] = insertelement <64 x i32> poison, i32 [[INDEX]], i32 0
125 ; CHECK-NEXT: [[BROADCAST_SPLAT:%.*]] = shufflevector <64 x i32> [[BROADCAST_SPLATINSERT]], <64 x i32> poison, <64 x i32> zeroinitializer
126 ; CHECK-NEXT: [[INDUCTION:%.*]] = add <64 x i32> [[BROADCAST_SPLAT]], <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15, i32 16, i32 17, i32 18, i32 19, i32 20, i32 21, i32 22, i32 23, i32 24, i32 25, i32 26, i32 27, i32 28, i32 29, i32 30, i32 31, i32 32, i32 33, i32 34, i32 35, i32 36, i32 37, i32 38, i32 39, i32 40, i32 41, i32 42, i32 43, i32 44, i32 45, i32 46, i32 47, i32 48, i32 49, i32 50, i32 51, i32 52, i32 53, i32 54, i32 55, i32 56, i32 57, i32 58, i32 59, i32 60, i32 61, i32 62, i32 63>
127 ; CHECK-NEXT: [[TMP0:%.*]] = add i32 [[INDEX]], 0
128 ; CHECK-NEXT: [[TMP1:%.*]] = icmp ule <64 x i32> [[INDUCTION]], <i32 202, i32 202, i32 202, i32 202, i32 202, i32 202, i32 202, i32 202, i32 202, i32 202, i32 202, i32 202, i32 202, i32 202, i32 202, i32 202, i32 202, i32 202, i32 202, i32 202, i32 202, i32 202, i32 202, i32 202, i32 202, i32 202, i32 202, i32 202, i32 202, i32 202, i32 202, i32 202, i32 202, i32 202, i32 202, i32 202, i32 202, i32 202, i32 202, i32 202, i32 202, i32 202, i32 202, i32 202, i32 202, i32 202, i32 202, i32 202, i32 202, i32 202, i32 202, i32 202, i32 202, i32 202, i32 202, i32 202, i32 202, i32 202, i32 202, i32 202, i32 202, i32 202, i32 202, i32 202>
129 ; CHECK-NEXT: [[TMP2:%.*]] = getelementptr inbounds [32 x i8], [32 x i8]* @tab, i32 0, i32 [[TMP0]]
130 ; CHECK-NEXT: [[TMP3:%.*]] = getelementptr inbounds i8, i8* [[TMP2]], i32 0
131 ; CHECK-NEXT: [[TMP4:%.*]] = bitcast i8* [[TMP3]] to <64 x i8>*
132 ; CHECK-NEXT: [[WIDE_MASKED_LOAD:%.*]] = call <64 x i8> @llvm.masked.load.v64i8.p0v64i8(<64 x i8>* [[TMP4]], i32 1, <64 x i1> [[TMP1]], <64 x i8> poison)
133 ; CHECK-NEXT: [[TMP5:%.*]] = icmp eq <64 x i8> [[WIDE_MASKED_LOAD]], zeroinitializer
134 ; CHECK-NEXT: [[TMP6:%.*]] = select <64 x i1> [[TMP5]], <64 x i8> <i8 2, i8 2, i8 2, i8 2, i8 2, i8 2, i8 2, i8 2, i8 2, i8 2, i8 2, i8 2, i8 2, i8 2, i8 2, i8 2, i8 2, i8 2, i8 2, i8 2, i8 2, i8 2, i8 2, i8 2, i8 2, i8 2, i8 2, i8 2, i8 2, i8 2, i8 2, i8 2, i8 2, i8 2, i8 2, i8 2, i8 2, i8 2, i8 2, i8 2, i8 2, i8 2, i8 2, i8 2, i8 2, i8 2, i8 2, i8 2, i8 2, i8 2, i8 2, i8 2, i8 2, i8 2, i8 2, i8 2, i8 2, i8 2, i8 2, i8 2, i8 2, i8 2, i8 2, i8 2>, <64 x i8> <i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1>
135 ; CHECK-NEXT: [[TMP7:%.*]] = bitcast i8* [[TMP3]] to <64 x i8>*
136 ; CHECK-NEXT: call void @llvm.masked.store.v64i8.p0v64i8(<64 x i8> [[TMP6]], <64 x i8>* [[TMP7]], i32 1, <64 x i1> [[TMP1]])
137 ; CHECK-NEXT: [[INDEX_NEXT]] = add i32 [[INDEX]], 64
138 ; CHECK-NEXT: [[TMP8:%.*]] = icmp eq i32 [[INDEX_NEXT]], 256
139 ; CHECK-NEXT: br i1 [[TMP8]], label [[MIDDLE_BLOCK:%.*]], label [[VECTOR_BODY]], [[LOOP4:!llvm.loop !.*]]
140 ; CHECK: middle.block:
141 ; CHECK-NEXT: br i1 true, label [[FOR_END:%.*]], label [[SCALAR_PH]]
143 ; CHECK-NEXT: [[BC_RESUME_VAL:%.*]] = phi i32 [ 256, [[MIDDLE_BLOCK]] ], [ 0, [[ENTRY:%.*]] ]
144 ; CHECK-NEXT: br label [[FOR_BODY:%.*]]
146 ; CHECK-NEXT: [[I_08:%.*]] = phi i32 [ [[BC_RESUME_VAL]], [[SCALAR_PH]] ], [ [[INC:%.*]], [[FOR_BODY]] ]
147 ; CHECK-NEXT: [[ARRAYIDX:%.*]] = getelementptr inbounds [32 x i8], [32 x i8]* @tab, i32 0, i32 [[I_08]]
148 ; CHECK-NEXT: [[TMP9:%.*]] = load i8, i8* [[ARRAYIDX]], align 1
149 ; CHECK-NEXT: [[CMP1:%.*]] = icmp eq i8 [[TMP9]], 0
150 ; CHECK-NEXT: [[DOT:%.*]] = select i1 [[CMP1]], i8 2, i8 1
151 ; CHECK-NEXT: store i8 [[DOT]], i8* [[ARRAYIDX]], align 1
152 ; CHECK-NEXT: [[INC]] = add nsw i32 [[I_08]], 1
153 ; CHECK-NEXT: [[EXITCOND:%.*]] = icmp eq i32 [[I_08]], 202
154 ; CHECK-NEXT: br i1 [[EXITCOND]], label [[FOR_END]], label [[FOR_BODY]], [[LOOP5:!llvm.loop !.*]]
156 ; CHECK-NEXT: ret i32 0
158 ; AUTOVF-LABEL: @foo_minsize(
159 ; AUTOVF-NEXT: entry:
160 ; AUTOVF-NEXT: br i1 false, label [[SCALAR_PH:%.*]], label [[VECTOR_PH:%.*]]
162 ; AUTOVF-NEXT: br label [[VECTOR_BODY:%.*]]
163 ; AUTOVF: vector.body:
164 ; AUTOVF-NEXT: [[INDEX:%.*]] = phi i32 [ 0, [[VECTOR_PH]] ], [ [[INDEX_NEXT:%.*]], [[VECTOR_BODY]] ]
165 ; AUTOVF-NEXT: [[BROADCAST_SPLATINSERT:%.*]] = insertelement <32 x i32> poison, i32 [[INDEX]], i32 0
166 ; AUTOVF-NEXT: [[BROADCAST_SPLAT:%.*]] = shufflevector <32 x i32> [[BROADCAST_SPLATINSERT]], <32 x i32> poison, <32 x i32> zeroinitializer
167 ; AUTOVF-NEXT: [[INDUCTION:%.*]] = add <32 x i32> [[BROADCAST_SPLAT]], <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15, i32 16, i32 17, i32 18, i32 19, i32 20, i32 21, i32 22, i32 23, i32 24, i32 25, i32 26, i32 27, i32 28, i32 29, i32 30, i32 31>
168 ; AUTOVF-NEXT: [[TMP0:%.*]] = add i32 [[INDEX]], 0
169 ; AUTOVF-NEXT: [[TMP1:%.*]] = icmp ule <32 x i32> [[INDUCTION]], <i32 202, i32 202, i32 202, i32 202, i32 202, i32 202, i32 202, i32 202, i32 202, i32 202, i32 202, i32 202, i32 202, i32 202, i32 202, i32 202, i32 202, i32 202, i32 202, i32 202, i32 202, i32 202, i32 202, i32 202, i32 202, i32 202, i32 202, i32 202, i32 202, i32 202, i32 202, i32 202>
170 ; AUTOVF-NEXT: [[TMP2:%.*]] = getelementptr inbounds [32 x i8], [32 x i8]* @tab, i32 0, i32 [[TMP0]]
171 ; AUTOVF-NEXT: [[TMP3:%.*]] = getelementptr inbounds i8, i8* [[TMP2]], i32 0
172 ; AUTOVF-NEXT: [[TMP4:%.*]] = bitcast i8* [[TMP3]] to <32 x i8>*
173 ; AUTOVF-NEXT: [[WIDE_MASKED_LOAD:%.*]] = call <32 x i8> @llvm.masked.load.v32i8.p0v32i8(<32 x i8>* [[TMP4]], i32 1, <32 x i1> [[TMP1]], <32 x i8> poison)
174 ; AUTOVF-NEXT: [[TMP5:%.*]] = icmp eq <32 x i8> [[WIDE_MASKED_LOAD]], zeroinitializer
175 ; AUTOVF-NEXT: [[TMP6:%.*]] = select <32 x i1> [[TMP5]], <32 x i8> <i8 2, i8 2, i8 2, i8 2, i8 2, i8 2, i8 2, i8 2, i8 2, i8 2, i8 2, i8 2, i8 2, i8 2, i8 2, i8 2, i8 2, i8 2, i8 2, i8 2, i8 2, i8 2, i8 2, i8 2, i8 2, i8 2, i8 2, i8 2, i8 2, i8 2, i8 2, i8 2>, <32 x i8> <i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1>
176 ; AUTOVF-NEXT: [[TMP7:%.*]] = bitcast i8* [[TMP3]] to <32 x i8>*
177 ; AUTOVF-NEXT: call void @llvm.masked.store.v32i8.p0v32i8(<32 x i8> [[TMP6]], <32 x i8>* [[TMP7]], i32 1, <32 x i1> [[TMP1]])
178 ; AUTOVF-NEXT: [[INDEX_NEXT]] = add i32 [[INDEX]], 32
179 ; AUTOVF-NEXT: [[TMP8:%.*]] = icmp eq i32 [[INDEX_NEXT]], 224
180 ; AUTOVF-NEXT: br i1 [[TMP8]], label [[MIDDLE_BLOCK:%.*]], label [[VECTOR_BODY]], [[LOOP4:!llvm.loop !.*]]
181 ; AUTOVF: middle.block:
182 ; AUTOVF-NEXT: br i1 true, label [[FOR_END:%.*]], label [[SCALAR_PH]]
184 ; AUTOVF-NEXT: [[BC_RESUME_VAL:%.*]] = phi i32 [ 224, [[MIDDLE_BLOCK]] ], [ 0, [[ENTRY:%.*]] ]
185 ; AUTOVF-NEXT: br label [[FOR_BODY:%.*]]
187 ; AUTOVF-NEXT: [[I_08:%.*]] = phi i32 [ [[BC_RESUME_VAL]], [[SCALAR_PH]] ], [ [[INC:%.*]], [[FOR_BODY]] ]
188 ; AUTOVF-NEXT: [[ARRAYIDX:%.*]] = getelementptr inbounds [32 x i8], [32 x i8]* @tab, i32 0, i32 [[I_08]]
189 ; AUTOVF-NEXT: [[TMP9:%.*]] = load i8, i8* [[ARRAYIDX]], align 1
190 ; AUTOVF-NEXT: [[CMP1:%.*]] = icmp eq i8 [[TMP9]], 0
191 ; AUTOVF-NEXT: [[DOT:%.*]] = select i1 [[CMP1]], i8 2, i8 1
192 ; AUTOVF-NEXT: store i8 [[DOT]], i8* [[ARRAYIDX]], align 1
193 ; AUTOVF-NEXT: [[INC]] = add nsw i32 [[I_08]], 1
194 ; AUTOVF-NEXT: [[EXITCOND:%.*]] = icmp eq i32 [[I_08]], 202
195 ; AUTOVF-NEXT: br i1 [[EXITCOND]], label [[FOR_END]], label [[FOR_BODY]], [[LOOP5:!llvm.loop !.*]]
197 ; AUTOVF-NEXT: ret i32 0
203 for.body: ; preds = %for.body, %entry
204 %i.08 = phi i32 [ 0, %entry ], [ %inc, %for.body ]
205 %arrayidx = getelementptr inbounds [32 x i8], [32 x i8]* @tab, i32 0, i32 %i.08
206 %0 = load i8, i8* %arrayidx, align 1
207 %cmp1 = icmp eq i8 %0, 0
208 %. = select i1 %cmp1, i8 2, i8 1
209 store i8 %., i8* %arrayidx, align 1
210 %inc = add nsw i32 %i.08, 1
211 %exitcond = icmp eq i32 %i.08, 202
212 br i1 %exitcond, label %for.end, label %for.body
214 for.end: ; preds = %for.body
218 attributes #1 = { minsize }
221 ; We can vectorize this one by refraining from versioning for stride==1.
222 define void @scev4stride1(i32* noalias nocapture %a, i32* noalias nocapture readonly %b, i32 %k) #2 {
223 ; CHECK-LABEL: @scev4stride1(
224 ; CHECK-NEXT: for.body.preheader:
225 ; CHECK-NEXT: br i1 false, label [[SCALAR_PH:%.*]], label [[VECTOR_PH:%.*]]
227 ; CHECK-NEXT: [[BROADCAST_SPLATINSERT:%.*]] = insertelement <64 x i32> poison, i32 [[K:%.*]], i32 0
228 ; CHECK-NEXT: [[BROADCAST_SPLAT:%.*]] = shufflevector <64 x i32> [[BROADCAST_SPLATINSERT]], <64 x i32> poison, <64 x i32> zeroinitializer
229 ; CHECK-NEXT: br label [[VECTOR_BODY:%.*]]
230 ; CHECK: vector.body:
231 ; CHECK-NEXT: [[INDEX:%.*]] = phi i32 [ 0, [[VECTOR_PH]] ], [ [[INDEX_NEXT:%.*]], [[VECTOR_BODY]] ]
232 ; CHECK-NEXT: [[VEC_IND:%.*]] = phi <64 x i32> [ <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15, i32 16, i32 17, i32 18, i32 19, i32 20, i32 21, i32 22, i32 23, i32 24, i32 25, i32 26, i32 27, i32 28, i32 29, i32 30, i32 31, i32 32, i32 33, i32 34, i32 35, i32 36, i32 37, i32 38, i32 39, i32 40, i32 41, i32 42, i32 43, i32 44, i32 45, i32 46, i32 47, i32 48, i32 49, i32 50, i32 51, i32 52, i32 53, i32 54, i32 55, i32 56, i32 57, i32 58, i32 59, i32 60, i32 61, i32 62, i32 63>, [[VECTOR_PH]] ], [ [[VEC_IND_NEXT:%.*]], [[VECTOR_BODY]] ]
233 ; CHECK-NEXT: [[TMP0:%.*]] = add i32 [[INDEX]], 0
234 ; CHECK-NEXT: [[TMP1:%.*]] = add i32 [[INDEX]], 1
235 ; CHECK-NEXT: [[TMP2:%.*]] = add i32 [[INDEX]], 2
236 ; CHECK-NEXT: [[TMP3:%.*]] = add i32 [[INDEX]], 3
237 ; CHECK-NEXT: [[TMP4:%.*]] = add i32 [[INDEX]], 4
238 ; CHECK-NEXT: [[TMP5:%.*]] = add i32 [[INDEX]], 5
239 ; CHECK-NEXT: [[TMP6:%.*]] = add i32 [[INDEX]], 6
240 ; CHECK-NEXT: [[TMP7:%.*]] = add i32 [[INDEX]], 7
241 ; CHECK-NEXT: [[TMP8:%.*]] = add i32 [[INDEX]], 8
242 ; CHECK-NEXT: [[TMP9:%.*]] = add i32 [[INDEX]], 9
243 ; CHECK-NEXT: [[TMP10:%.*]] = add i32 [[INDEX]], 10
244 ; CHECK-NEXT: [[TMP11:%.*]] = add i32 [[INDEX]], 11
245 ; CHECK-NEXT: [[TMP12:%.*]] = add i32 [[INDEX]], 12
246 ; CHECK-NEXT: [[TMP13:%.*]] = add i32 [[INDEX]], 13
247 ; CHECK-NEXT: [[TMP14:%.*]] = add i32 [[INDEX]], 14
248 ; CHECK-NEXT: [[TMP15:%.*]] = add i32 [[INDEX]], 15
249 ; CHECK-NEXT: [[TMP16:%.*]] = add i32 [[INDEX]], 16
250 ; CHECK-NEXT: [[TMP17:%.*]] = add i32 [[INDEX]], 17
251 ; CHECK-NEXT: [[TMP18:%.*]] = add i32 [[INDEX]], 18
252 ; CHECK-NEXT: [[TMP19:%.*]] = add i32 [[INDEX]], 19
253 ; CHECK-NEXT: [[TMP20:%.*]] = add i32 [[INDEX]], 20
254 ; CHECK-NEXT: [[TMP21:%.*]] = add i32 [[INDEX]], 21
255 ; CHECK-NEXT: [[TMP22:%.*]] = add i32 [[INDEX]], 22
256 ; CHECK-NEXT: [[TMP23:%.*]] = add i32 [[INDEX]], 23
257 ; CHECK-NEXT: [[TMP24:%.*]] = add i32 [[INDEX]], 24
258 ; CHECK-NEXT: [[TMP25:%.*]] = add i32 [[INDEX]], 25
259 ; CHECK-NEXT: [[TMP26:%.*]] = add i32 [[INDEX]], 26
260 ; CHECK-NEXT: [[TMP27:%.*]] = add i32 [[INDEX]], 27
261 ; CHECK-NEXT: [[TMP28:%.*]] = add i32 [[INDEX]], 28
262 ; CHECK-NEXT: [[TMP29:%.*]] = add i32 [[INDEX]], 29
263 ; CHECK-NEXT: [[TMP30:%.*]] = add i32 [[INDEX]], 30
264 ; CHECK-NEXT: [[TMP31:%.*]] = add i32 [[INDEX]], 31
265 ; CHECK-NEXT: [[TMP32:%.*]] = add i32 [[INDEX]], 32
266 ; CHECK-NEXT: [[TMP33:%.*]] = add i32 [[INDEX]], 33
267 ; CHECK-NEXT: [[TMP34:%.*]] = add i32 [[INDEX]], 34
268 ; CHECK-NEXT: [[TMP35:%.*]] = add i32 [[INDEX]], 35
269 ; CHECK-NEXT: [[TMP36:%.*]] = add i32 [[INDEX]], 36
270 ; CHECK-NEXT: [[TMP37:%.*]] = add i32 [[INDEX]], 37
271 ; CHECK-NEXT: [[TMP38:%.*]] = add i32 [[INDEX]], 38
272 ; CHECK-NEXT: [[TMP39:%.*]] = add i32 [[INDEX]], 39
273 ; CHECK-NEXT: [[TMP40:%.*]] = add i32 [[INDEX]], 40
274 ; CHECK-NEXT: [[TMP41:%.*]] = add i32 [[INDEX]], 41
275 ; CHECK-NEXT: [[TMP42:%.*]] = add i32 [[INDEX]], 42
276 ; CHECK-NEXT: [[TMP43:%.*]] = add i32 [[INDEX]], 43
277 ; CHECK-NEXT: [[TMP44:%.*]] = add i32 [[INDEX]], 44
278 ; CHECK-NEXT: [[TMP45:%.*]] = add i32 [[INDEX]], 45
279 ; CHECK-NEXT: [[TMP46:%.*]] = add i32 [[INDEX]], 46
280 ; CHECK-NEXT: [[TMP47:%.*]] = add i32 [[INDEX]], 47
281 ; CHECK-NEXT: [[TMP48:%.*]] = add i32 [[INDEX]], 48
282 ; CHECK-NEXT: [[TMP49:%.*]] = add i32 [[INDEX]], 49
283 ; CHECK-NEXT: [[TMP50:%.*]] = add i32 [[INDEX]], 50
284 ; CHECK-NEXT: [[TMP51:%.*]] = add i32 [[INDEX]], 51
285 ; CHECK-NEXT: [[TMP52:%.*]] = add i32 [[INDEX]], 52
286 ; CHECK-NEXT: [[TMP53:%.*]] = add i32 [[INDEX]], 53
287 ; CHECK-NEXT: [[TMP54:%.*]] = add i32 [[INDEX]], 54
288 ; CHECK-NEXT: [[TMP55:%.*]] = add i32 [[INDEX]], 55
289 ; CHECK-NEXT: [[TMP56:%.*]] = add i32 [[INDEX]], 56
290 ; CHECK-NEXT: [[TMP57:%.*]] = add i32 [[INDEX]], 57
291 ; CHECK-NEXT: [[TMP58:%.*]] = add i32 [[INDEX]], 58
292 ; CHECK-NEXT: [[TMP59:%.*]] = add i32 [[INDEX]], 59
293 ; CHECK-NEXT: [[TMP60:%.*]] = add i32 [[INDEX]], 60
294 ; CHECK-NEXT: [[TMP61:%.*]] = add i32 [[INDEX]], 61
295 ; CHECK-NEXT: [[TMP62:%.*]] = add i32 [[INDEX]], 62
296 ; CHECK-NEXT: [[TMP63:%.*]] = add i32 [[INDEX]], 63
297 ; CHECK-NEXT: [[TMP64:%.*]] = mul nsw <64 x i32> [[VEC_IND]], [[BROADCAST_SPLAT]]
298 ; CHECK-NEXT: [[TMP65:%.*]] = getelementptr inbounds i32, i32* [[B:%.*]], <64 x i32> [[TMP64]]
299 ; CHECK-NEXT: [[WIDE_MASKED_GATHER:%.*]] = call <64 x i32> @llvm.masked.gather.v64i32.v64p0i32(<64 x i32*> [[TMP65]], i32 4, <64 x i1> <i1 true, i1 true, i1 true, i1 true, i1 true, i1 true, i1 true, i1 true, i1 true, i1 true, i1 true, i1 true, i1 true, i1 true, i1 true, i1 true, i1 true, i1 true, i1 true, i1 true, i1 true, i1 true, i1 true, i1 true, i1 true, i1 true, i1 true, i1 true, i1 true, i1 true, i1 true, i1 true, i1 true, i1 true, i1 true, i1 true, i1 true, i1 true, i1 true, i1 true, i1 true, i1 true, i1 true, i1 true, i1 true, i1 true, i1 true, i1 true, i1 true, i1 true, i1 true, i1 true, i1 true, i1 true, i1 true, i1 true, i1 true, i1 true, i1 true, i1 true, i1 true, i1 true, i1 true, i1 true>, <64 x i32> undef)
300 ; CHECK-NEXT: [[TMP66:%.*]] = getelementptr inbounds i32, i32* [[A:%.*]], i32 [[TMP0]]
301 ; CHECK-NEXT: [[TMP67:%.*]] = getelementptr inbounds i32, i32* [[TMP66]], i32 0
302 ; CHECK-NEXT: [[TMP68:%.*]] = bitcast i32* [[TMP67]] to <64 x i32>*
303 ; CHECK-NEXT: store <64 x i32> [[WIDE_MASKED_GATHER]], <64 x i32>* [[TMP68]], align 4
304 ; CHECK-NEXT: [[INDEX_NEXT]] = add nuw i32 [[INDEX]], 64
305 ; CHECK-NEXT: [[VEC_IND_NEXT]] = add <64 x i32> [[VEC_IND]], <i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64>
306 ; CHECK-NEXT: [[TMP69:%.*]] = icmp eq i32 [[INDEX_NEXT]], 256
307 ; CHECK-NEXT: br i1 [[TMP69]], label [[MIDDLE_BLOCK:%.*]], label [[VECTOR_BODY]], [[LOOP6:!llvm.loop !.*]]
308 ; CHECK: middle.block:
309 ; CHECK-NEXT: [[CMP_N:%.*]] = icmp eq i32 256, 256
310 ; CHECK-NEXT: br i1 [[CMP_N]], label [[FOR_END_LOOPEXIT:%.*]], label [[SCALAR_PH]]
312 ; CHECK-NEXT: [[BC_RESUME_VAL:%.*]] = phi i32 [ 256, [[MIDDLE_BLOCK]] ], [ 0, [[FOR_BODY_PREHEADER:%.*]] ]
313 ; CHECK-NEXT: br label [[FOR_BODY:%.*]]
315 ; CHECK-NEXT: [[I_07:%.*]] = phi i32 [ [[INC:%.*]], [[FOR_BODY]] ], [ [[BC_RESUME_VAL]], [[SCALAR_PH]] ]
316 ; CHECK-NEXT: [[MUL:%.*]] = mul nsw i32 [[I_07]], [[K]]
317 ; CHECK-NEXT: [[ARRAYIDX:%.*]] = getelementptr inbounds i32, i32* [[B]], i32 [[MUL]]
318 ; CHECK-NEXT: [[TMP70:%.*]] = load i32, i32* [[ARRAYIDX]], align 4
319 ; CHECK-NEXT: [[ARRAYIDX1:%.*]] = getelementptr inbounds i32, i32* [[A]], i32 [[I_07]]
320 ; CHECK-NEXT: store i32 [[TMP70]], i32* [[ARRAYIDX1]], align 4
321 ; CHECK-NEXT: [[INC]] = add nuw nsw i32 [[I_07]], 1
322 ; CHECK-NEXT: [[EXITCOND:%.*]] = icmp eq i32 [[INC]], 256
323 ; CHECK-NEXT: br i1 [[EXITCOND]], label [[FOR_END_LOOPEXIT]], label [[FOR_BODY]], [[LOOP7:!llvm.loop !.*]]
324 ; CHECK: for.end.loopexit:
325 ; CHECK-NEXT: ret void
327 ; AUTOVF-LABEL: @scev4stride1(
328 ; AUTOVF-NEXT: for.body.preheader:
329 ; AUTOVF-NEXT: br i1 false, label [[SCALAR_PH:%.*]], label [[VECTOR_PH:%.*]]
331 ; AUTOVF-NEXT: [[BROADCAST_SPLATINSERT:%.*]] = insertelement <8 x i32> poison, i32 [[K:%.*]], i32 0
332 ; AUTOVF-NEXT: [[BROADCAST_SPLAT:%.*]] = shufflevector <8 x i32> [[BROADCAST_SPLATINSERT]], <8 x i32> poison, <8 x i32> zeroinitializer
333 ; AUTOVF-NEXT: br label [[VECTOR_BODY:%.*]]
334 ; AUTOVF: vector.body:
335 ; AUTOVF-NEXT: [[INDEX:%.*]] = phi i32 [ 0, [[VECTOR_PH]] ], [ [[INDEX_NEXT:%.*]], [[VECTOR_BODY]] ]
336 ; AUTOVF-NEXT: [[VEC_IND:%.*]] = phi <8 x i32> [ <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7>, [[VECTOR_PH]] ], [ [[VEC_IND_NEXT:%.*]], [[VECTOR_BODY]] ]
337 ; AUTOVF-NEXT: [[TMP0:%.*]] = add i32 [[INDEX]], 0
338 ; AUTOVF-NEXT: [[TMP1:%.*]] = add i32 [[INDEX]], 1
339 ; AUTOVF-NEXT: [[TMP2:%.*]] = add i32 [[INDEX]], 2
340 ; AUTOVF-NEXT: [[TMP3:%.*]] = add i32 [[INDEX]], 3
341 ; AUTOVF-NEXT: [[TMP4:%.*]] = add i32 [[INDEX]], 4
342 ; AUTOVF-NEXT: [[TMP5:%.*]] = add i32 [[INDEX]], 5
343 ; AUTOVF-NEXT: [[TMP6:%.*]] = add i32 [[INDEX]], 6
344 ; AUTOVF-NEXT: [[TMP7:%.*]] = add i32 [[INDEX]], 7
345 ; AUTOVF-NEXT: [[TMP8:%.*]] = mul nsw <8 x i32> [[VEC_IND]], [[BROADCAST_SPLAT]]
346 ; AUTOVF-NEXT: [[TMP9:%.*]] = getelementptr inbounds i32, i32* [[B:%.*]], <8 x i32> [[TMP8]]
347 ; AUTOVF-NEXT: [[WIDE_MASKED_GATHER:%.*]] = call <8 x i32> @llvm.masked.gather.v8i32.v8p0i32(<8 x i32*> [[TMP9]], i32 4, <8 x i1> <i1 true, i1 true, i1 true, i1 true, i1 true, i1 true, i1 true, i1 true>, <8 x i32> undef)
348 ; AUTOVF-NEXT: [[TMP10:%.*]] = getelementptr inbounds i32, i32* [[A:%.*]], i32 [[TMP0]]
349 ; AUTOVF-NEXT: [[TMP11:%.*]] = getelementptr inbounds i32, i32* [[TMP10]], i32 0
350 ; AUTOVF-NEXT: [[TMP12:%.*]] = bitcast i32* [[TMP11]] to <8 x i32>*
351 ; AUTOVF-NEXT: store <8 x i32> [[WIDE_MASKED_GATHER]], <8 x i32>* [[TMP12]], align 4
352 ; AUTOVF-NEXT: [[INDEX_NEXT]] = add nuw i32 [[INDEX]], 8
353 ; AUTOVF-NEXT: [[VEC_IND_NEXT]] = add <8 x i32> [[VEC_IND]], <i32 8, i32 8, i32 8, i32 8, i32 8, i32 8, i32 8, i32 8>
354 ; AUTOVF-NEXT: [[TMP13:%.*]] = icmp eq i32 [[INDEX_NEXT]], 256
355 ; AUTOVF-NEXT: br i1 [[TMP13]], label [[MIDDLE_BLOCK:%.*]], label [[VECTOR_BODY]], [[LOOP6:!llvm.loop !.*]]
356 ; AUTOVF: middle.block:
357 ; AUTOVF-NEXT: [[CMP_N:%.*]] = icmp eq i32 256, 256
358 ; AUTOVF-NEXT: br i1 [[CMP_N]], label [[FOR_END_LOOPEXIT:%.*]], label [[SCALAR_PH]]
360 ; AUTOVF-NEXT: [[BC_RESUME_VAL:%.*]] = phi i32 [ 256, [[MIDDLE_BLOCK]] ], [ 0, [[FOR_BODY_PREHEADER:%.*]] ]
361 ; AUTOVF-NEXT: br label [[FOR_BODY:%.*]]
363 ; AUTOVF-NEXT: [[I_07:%.*]] = phi i32 [ [[INC:%.*]], [[FOR_BODY]] ], [ [[BC_RESUME_VAL]], [[SCALAR_PH]] ]
364 ; AUTOVF-NEXT: [[MUL:%.*]] = mul nsw i32 [[I_07]], [[K]]
365 ; AUTOVF-NEXT: [[ARRAYIDX:%.*]] = getelementptr inbounds i32, i32* [[B]], i32 [[MUL]]
366 ; AUTOVF-NEXT: [[TMP14:%.*]] = load i32, i32* [[ARRAYIDX]], align 4
367 ; AUTOVF-NEXT: [[ARRAYIDX1:%.*]] = getelementptr inbounds i32, i32* [[A]], i32 [[I_07]]
368 ; AUTOVF-NEXT: store i32 [[TMP14]], i32* [[ARRAYIDX1]], align 4
369 ; AUTOVF-NEXT: [[INC]] = add nuw nsw i32 [[I_07]], 1
370 ; AUTOVF-NEXT: [[EXITCOND:%.*]] = icmp eq i32 [[INC]], 256
371 ; AUTOVF-NEXT: br i1 [[EXITCOND]], label [[FOR_END_LOOPEXIT]], label [[FOR_BODY]], [[LOOP7:!llvm.loop !.*]]
372 ; AUTOVF: for.end.loopexit:
373 ; AUTOVF-NEXT: ret void
378 for.body: ; preds = %for.body.preheader, %for.body
379 %i.07 = phi i32 [ %inc, %for.body ], [ 0, %for.body.preheader ]
380 %mul = mul nsw i32 %i.07, %k
381 %arrayidx = getelementptr inbounds i32, i32* %b, i32 %mul
382 %0 = load i32, i32* %arrayidx, align 4
383 %arrayidx1 = getelementptr inbounds i32, i32* %a, i32 %i.07
384 store i32 %0, i32* %arrayidx1, align 4
385 %inc = add nuw nsw i32 %i.07, 1
386 %exitcond = icmp eq i32 %inc, 256
387 br i1 %exitcond, label %for.end.loopexit, label %for.body
389 for.end.loopexit: ; preds = %for.body
393 attributes #2 = { optsize }
397 ; We can't vectorize this one because we version for overflow check and tiny
398 ; trip count leads to opt-for-size (which otherwise could fold the tail by
400 define i32 @main() local_unnamed_addr {
401 ; CHECK-LABEL: @main(
402 ; CHECK-NEXT: while.cond:
403 ; CHECK-NEXT: br label [[FOR_COND:%.*]]
405 ; CHECK-NEXT: [[D_0:%.*]] = phi i32 [ 0, [[WHILE_COND:%.*]] ], [ [[ADD:%.*]], [[FOR_COND]] ]
406 ; CHECK-NEXT: [[CONV:%.*]] = and i32 [[D_0]], 65535
407 ; CHECK-NEXT: [[CMP:%.*]] = icmp ult i32 [[CONV]], 4
408 ; CHECK-NEXT: [[ADD]] = add nuw nsw i32 [[CONV]], 1
409 ; CHECK-NEXT: br i1 [[CMP]], label [[FOR_COND]], label [[WHILE_COND_LOOPEXIT:%.*]]
410 ; CHECK: while.cond.loopexit:
411 ; CHECK-NEXT: ret i32 0
413 ; AUTOVF-LABEL: @main(
414 ; AUTOVF-NEXT: while.cond:
415 ; AUTOVF-NEXT: br label [[FOR_COND:%.*]]
417 ; AUTOVF-NEXT: [[D_0:%.*]] = phi i32 [ 0, [[WHILE_COND:%.*]] ], [ [[ADD:%.*]], [[FOR_COND]] ]
418 ; AUTOVF-NEXT: [[CONV:%.*]] = and i32 [[D_0]], 65535
419 ; AUTOVF-NEXT: [[CMP:%.*]] = icmp ult i32 [[CONV]], 4
420 ; AUTOVF-NEXT: [[ADD]] = add nuw nsw i32 [[CONV]], 1
421 ; AUTOVF-NEXT: br i1 [[CMP]], label [[FOR_COND]], label [[WHILE_COND_LOOPEXIT:%.*]]
422 ; AUTOVF: while.cond.loopexit:
423 ; AUTOVF-NEXT: ret i32 0
429 %d.0 = phi i32 [ 0, %while.cond ], [ %add, %for.cond ]
430 %conv = and i32 %d.0, 65535
431 %cmp = icmp ult i32 %conv, 4
432 %add = add nuw nsw i32 %conv, 1
433 br i1 %cmp, label %for.cond, label %while.cond.loopexit