1 ; RUN: llc < %s | FileCheck %s
3 ; Check that the SCEVs produced from the multiple loops don't attempt to get
4 ; combines in invalid ways. The LSR filtering could attempt to combine addrecs
5 ; from different loops.
7 target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
8 target triple = "x86_64-unknown-linux-gnu"
10 define void @in4dob_(ptr nocapture writeonly %0, ptr nocapture readonly %1, ptr nocapture readonly %2, i64 %3, i1 %min.iters.check840) "target-cpu"="icelake-server" {
11 ; CHECK-LABEL: in4dob_:
12 ; CHECK: .LBB0_6: # %vector.body807
13 ; CHECK-NEXT: # =>This Inner Loop Header: Depth=1
14 ; CHECK-NEXT: leaq (%rdi,%r9), %r11
15 ; CHECK-NEXT: vmovups %ymm0, (%rax,%r11)
16 ; CHECK-NEXT: vmovups %ymm0, 1(%rax,%r11)
17 ; CHECK-NEXT: vmovups %ymm0, 2(%rax,%r11)
18 ; CHECK-NEXT: vmovups %ymm0, 3(%rax,%r11)
19 ; CHECK-NEXT: vmovups %ymm0, 4(%rax,%r11)
20 ; CHECK-NEXT: vmovups %ymm0, 5(%rax,%r11)
21 ; CHECK-NEXT: vmovups %ymm0, 6(%rax,%r11)
22 ; CHECK-NEXT: vmovups %ymm0, 7(%rax,%r11)
23 ; CHECK-NEXT: addq $8, %r9
24 ; CHECK-NEXT: cmpq %r9, %r10
25 ; CHECK-NEXT: jne .LBB0_6
26 ; CHECK: .LBB0_14: # %vector.body847
27 ; CHECK-NEXT: # =>This Inner Loop Header: Depth=1
28 ; CHECK-NEXT: leaq (%rdi,%rcx), %r8
29 ; CHECK-NEXT: vmovups %ymm0, 96(%rax,%r8)
30 ; CHECK-NEXT: vmovups %ymm0, 97(%rax,%r8)
31 ; CHECK-NEXT: vmovups %ymm0, 98(%rax,%r8)
32 ; CHECK-NEXT: vmovups %ymm0, 99(%rax,%r8)
33 ; CHECK-NEXT: vmovups %ymm0, 100(%rax,%r8)
34 ; CHECK-NEXT: vmovups %ymm0, 101(%rax,%r8)
35 ; CHECK-NEXT: vmovups %ymm0, 102(%rax,%r8)
36 ; CHECK-NEXT: vmovups %ymm0, 103(%rax,%r8)
37 ; CHECK-NEXT: addq $8, %rcx
38 ; CHECK-NEXT: cmpq %rcx, %rdx
39 ; CHECK-NEXT: jne .LBB0_14
44 5: ; preds = %16, %.preheader263
45 %lsr.iv1135 = phi ptr [ %0, %.preheader263 ], [ %uglygep1136, %16 ]
46 %indvars.iv487 = phi i64 [ 1, %.preheader263 ], [ %indvars.iv.next488, %16 ]
47 %6 = getelementptr float, ptr %1, i64 %indvars.iv487
48 %7 = load float, ptr %6, align 4
49 %8 = fcmp oeq float %7, 0.000000e+00
50 %9 = getelementptr float, ptr %2, i64 %indvars.iv487
51 %10 = load float, ptr %9, align 4
52 %11 = fcmp oeq float %10, 0.000000e+00
54 br i1 %12, label %vector.body807.preheader, label %16
56 vector.body807.preheader: ; preds = %5
58 %xtraiter = and i64 %13, 7
59 %14 = icmp ult i64 %3, 7
60 br i1 %14, label %.lr.ph373.unr-lcssa, label %vector.body807.preheader.new
62 vector.body807.preheader.new: ; preds = %vector.body807.preheader
63 %unroll_iter = and i64 %13, -8
64 br label %vector.body807
66 vector.body807: ; preds = %vector.body807, %vector.body807.preheader.new
67 %lsr.iv1194 = phi i64 [ 0, %vector.body807.preheader.new ], [ %lsr.iv.next1195.7, %vector.body807 ]
68 %niter = phi i64 [ 0, %vector.body807.preheader.new ], [ %niter.next.7, %vector.body807 ]
69 %uglygep1197 = getelementptr i8, ptr %lsr.iv1135, i64 %lsr.iv1194
70 store <8 x float> zeroinitializer, ptr %uglygep1197, align 4
71 %lsr.iv.next1195 = or disjoint i64 %lsr.iv1194, 1
72 %uglygep1197.1 = getelementptr i8, ptr %lsr.iv1135, i64 %lsr.iv.next1195
73 store <8 x float> zeroinitializer, ptr %uglygep1197.1, align 4
74 %lsr.iv.next1195.1 = or disjoint i64 %lsr.iv1194, 2
75 %uglygep1197.2 = getelementptr i8, ptr %lsr.iv1135, i64 %lsr.iv.next1195.1
76 store <8 x float> zeroinitializer, ptr %uglygep1197.2, align 4
77 %lsr.iv.next1195.2 = or disjoint i64 %lsr.iv1194, 3
78 %uglygep1197.3 = getelementptr i8, ptr %lsr.iv1135, i64 %lsr.iv.next1195.2
79 store <8 x float> zeroinitializer, ptr %uglygep1197.3, align 4
80 %lsr.iv.next1195.3 = or disjoint i64 %lsr.iv1194, 4
81 %uglygep1197.4 = getelementptr i8, ptr %lsr.iv1135, i64 %lsr.iv.next1195.3
82 store <8 x float> zeroinitializer, ptr %uglygep1197.4, align 4
83 %lsr.iv.next1195.4 = or disjoint i64 %lsr.iv1194, 5
84 %uglygep1197.5 = getelementptr i8, ptr %lsr.iv1135, i64 %lsr.iv.next1195.4
85 store <8 x float> zeroinitializer, ptr %uglygep1197.5, align 4
86 %lsr.iv.next1195.5 = or disjoint i64 %lsr.iv1194, 6
87 %uglygep1197.6 = getelementptr i8, ptr %lsr.iv1135, i64 %lsr.iv.next1195.5
88 store <8 x float> zeroinitializer, ptr %uglygep1197.6, align 4
89 %lsr.iv.next1195.6 = or disjoint i64 %lsr.iv1194, 7
90 %uglygep1197.7 = getelementptr i8, ptr %lsr.iv1135, i64 %lsr.iv.next1195.6
91 store <8 x float> zeroinitializer, ptr %uglygep1197.7, align 4
92 %lsr.iv.next1195.7 = add i64 %lsr.iv1194, 8
93 %niter.next.7 = add i64 %niter, 8
94 %niter.ncmp.7 = icmp eq i64 %niter.next.7, %unroll_iter
95 br i1 %niter.ncmp.7, label %.lr.ph373.unr-lcssa.loopexit, label %vector.body807
97 .lr.ph373.unr-lcssa.loopexit: ; preds = %vector.body807
98 br label %.lr.ph373.unr-lcssa
100 .lr.ph373.unr-lcssa: ; preds = %.lr.ph373.unr-lcssa.loopexit, %vector.body807.preheader
101 %lsr.iv1194.unr = phi i64 [ 0, %vector.body807.preheader ], [ %lsr.iv.next1195.7, %.lr.ph373.unr-lcssa.loopexit ]
102 %lcmp.mod.not = icmp eq i64 %xtraiter, 0
103 br i1 %lcmp.mod.not, label %.lr.ph373, label %vector.body807.epil.preheader
105 vector.body807.epil.preheader: ; preds = %.lr.ph373.unr-lcssa
106 br label %vector.body807.epil
108 vector.body807.epil: ; preds = %vector.body807.epil.preheader, %vector.body807.epil
109 %lsr.iv1194.epil = phi i64 [ %lsr.iv.next1195.epil, %vector.body807.epil ], [ %lsr.iv1194.unr, %vector.body807.epil.preheader ]
110 %epil.iter = phi i64 [ %epil.iter.next, %vector.body807.epil ], [ 0, %vector.body807.epil.preheader ]
111 %uglygep1197.epil = getelementptr i8, ptr %lsr.iv1135, i64 %lsr.iv1194.epil
112 store <8 x float> zeroinitializer, ptr %uglygep1197.epil, align 4
113 %lsr.iv.next1195.epil = add i64 %lsr.iv1194.epil, 1
114 %epil.iter.next = add i64 %epil.iter, 1
115 %epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter
116 br i1 %epil.iter.cmp.not, label %.lr.ph373.loopexit, label %vector.body807.epil
118 .lr.ph373.loopexit: ; preds = %vector.body807.epil
121 .lr.ph373: ; preds = %.lr.ph373.loopexit, %.lr.ph373.unr-lcssa
122 br i1 %min.iters.check840, label %scalar.ph839.preheader, label %vector.body847.preheader
124 vector.body847.preheader: ; preds = %.lr.ph373
125 %uglygep11551 = getelementptr i8, ptr %lsr.iv1135, i64 96
126 %xtraiter12 = and i64 %13, 7
127 %15 = icmp ult i64 %3, 7
128 br i1 %15, label %common.ret.loopexit.unr-lcssa, label %vector.body847.preheader.new
130 vector.body847.preheader.new: ; preds = %vector.body847.preheader
131 %unroll_iter15 = and i64 %13, -8
132 br label %vector.body847
134 vector.body847: ; preds = %vector.body847, %vector.body847.preheader.new
135 %lsr.iv1152 = phi i64 [ 0, %vector.body847.preheader.new ], [ %lsr.iv.next1153.7, %vector.body847 ]
136 %niter16 = phi i64 [ 0, %vector.body847.preheader.new ], [ %niter16.next.7, %vector.body847 ]
137 %uglygep1156 = getelementptr i8, ptr %uglygep11551, i64 %lsr.iv1152
138 store <8 x float> zeroinitializer, ptr %uglygep1156, align 4
139 %lsr.iv.next1153 = or disjoint i64 %lsr.iv1152, 1
140 %uglygep1156.1 = getelementptr i8, ptr %uglygep11551, i64 %lsr.iv.next1153
141 store <8 x float> zeroinitializer, ptr %uglygep1156.1, align 4
142 %lsr.iv.next1153.1 = or disjoint i64 %lsr.iv1152, 2
143 %uglygep1156.2 = getelementptr i8, ptr %uglygep11551, i64 %lsr.iv.next1153.1
144 store <8 x float> zeroinitializer, ptr %uglygep1156.2, align 4
145 %lsr.iv.next1153.2 = or disjoint i64 %lsr.iv1152, 3
146 %uglygep1156.3 = getelementptr i8, ptr %uglygep11551, i64 %lsr.iv.next1153.2
147 store <8 x float> zeroinitializer, ptr %uglygep1156.3, align 4
148 %lsr.iv.next1153.3 = or disjoint i64 %lsr.iv1152, 4
149 %uglygep1156.4 = getelementptr i8, ptr %uglygep11551, i64 %lsr.iv.next1153.3
150 store <8 x float> zeroinitializer, ptr %uglygep1156.4, align 4
151 %lsr.iv.next1153.4 = or disjoint i64 %lsr.iv1152, 5
152 %uglygep1156.5 = getelementptr i8, ptr %uglygep11551, i64 %lsr.iv.next1153.4
153 store <8 x float> zeroinitializer, ptr %uglygep1156.5, align 4
154 %lsr.iv.next1153.5 = or disjoint i64 %lsr.iv1152, 6
155 %uglygep1156.6 = getelementptr i8, ptr %uglygep11551, i64 %lsr.iv.next1153.5
156 store <8 x float> zeroinitializer, ptr %uglygep1156.6, align 4
157 %lsr.iv.next1153.6 = or disjoint i64 %lsr.iv1152, 7
158 %uglygep1156.7 = getelementptr i8, ptr %uglygep11551, i64 %lsr.iv.next1153.6
159 store <8 x float> zeroinitializer, ptr %uglygep1156.7, align 4
160 %lsr.iv.next1153.7 = add i64 %lsr.iv1152, 8
161 %niter16.next.7 = add i64 %niter16, 8
162 %niter16.ncmp.7 = icmp eq i64 %niter16.next.7, %unroll_iter15
163 br i1 %niter16.ncmp.7, label %common.ret.loopexit.unr-lcssa.loopexit, label %vector.body847
165 common.ret.loopexit.unr-lcssa.loopexit: ; preds = %vector.body847
166 br label %common.ret.loopexit.unr-lcssa
168 common.ret.loopexit.unr-lcssa: ; preds = %common.ret.loopexit.unr-lcssa.loopexit, %vector.body847.preheader
169 %lsr.iv1152.unr = phi i64 [ 0, %vector.body847.preheader ], [ %lsr.iv.next1153.7, %common.ret.loopexit.unr-lcssa.loopexit ]
170 %lcmp.mod14.not = icmp eq i64 %xtraiter12, 0
171 br i1 %lcmp.mod14.not, label %common.ret, label %vector.body847.epil.preheader
173 vector.body847.epil.preheader: ; preds = %common.ret.loopexit.unr-lcssa
174 br label %vector.body847.epil
176 vector.body847.epil: ; preds = %vector.body847.epil.preheader, %vector.body847.epil
177 %lsr.iv1152.epil = phi i64 [ %lsr.iv.next1153.epil, %vector.body847.epil ], [ %lsr.iv1152.unr, %vector.body847.epil.preheader ]
178 %epil.iter13 = phi i64 [ %epil.iter13.next, %vector.body847.epil ], [ 0, %vector.body847.epil.preheader ]
179 %uglygep1156.epil = getelementptr i8, ptr %uglygep11551, i64 %lsr.iv1152.epil
180 store <8 x float> zeroinitializer, ptr %uglygep1156.epil, align 4
181 %lsr.iv.next1153.epil = add i64 %lsr.iv1152.epil, 1
182 %epil.iter13.next = add i64 %epil.iter13, 1
183 %epil.iter13.cmp.not = icmp eq i64 %epil.iter13.next, %xtraiter12
184 br i1 %epil.iter13.cmp.not, label %common.ret.loopexit, label %vector.body847.epil
186 common.ret.loopexit: ; preds = %vector.body847.epil
189 common.ret.loopexit1: ; preds = %16
192 common.ret: ; preds = %common.ret.loopexit1, %common.ret.loopexit, %scalar.ph839.preheader, %common.ret.loopexit.unr-lcssa
195 scalar.ph839.preheader: ; preds = %.lr.ph373
196 store float 0.000000e+00, ptr %0, align 4
200 %indvars.iv.next488 = add i64 %indvars.iv487, 1
201 %exitcond492.not = icmp eq i64 %indvars.iv.next488, %3
202 %uglygep1136 = getelementptr i8, ptr %lsr.iv1135, i64 %4
203 br i1 %exitcond492.not, label %common.ret.loopexit1, label %5