1; RUN: opt -S -loop-reduce -mcpu=corei7-avx -mtriple=x86_64-apple-macosx < %s | FileCheck %s
2
3target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
4
5define void @indvar_expansion(i8* nocapture readonly %rowsptr) {
6entry:
7  br label %for.cond
8
9; SCEVExpander used to create induction variables in the loop %for.cond while
10; expanding the recurrence start value of loop strength reduced values from
11; %vector.body.
12
13; CHECK-LABEL: indvar_expansion
14; CHECK: for.cond:
15; CHECK-NOT: phi i3
16; CHECK: br i1 {{.+}}, label %for.cond
17
18for.cond:
19  %indvars.iv44 = phi i64 [ %indvars.iv.next45, %for.cond ], [ 0, %entry ]
20  %cmp = icmp eq i8 undef, 0
21  %indvars.iv.next45 = add nuw nsw i64 %indvars.iv44, 1
22  br i1 %cmp, label %for.cond, label %for.cond2
23
24for.cond2:
25  br i1 undef, label %for.cond2, label %for.body14.lr.ph
26
27for.body14.lr.ph:
28  %sext = shl i64 %indvars.iv44, 32
29  %0 = ashr exact i64 %sext, 32
30  %1 = sub i64 undef, %indvars.iv44
31  %2 = and i64 %1, 4294967295
32  %3 = add i64 %2, 1
33  %fold = add i64 %1, 1
34  %n.mod.vf = and i64 %fold, 7
35  %n.vec = sub i64 %3, %n.mod.vf
36  %end.idx.rnd.down = add i64 %n.vec, %0
37  br label %vector.body
38
39vector.body:
40  %index = phi i64 [ %index.next, %vector.body ], [ %0, %for.body14.lr.ph ]
41  %4 = getelementptr inbounds i8, i8* %rowsptr, i64 %index
42  %5 = bitcast i8* %4 to <4 x i8>*
43  %wide.load = load <4 x i8>, <4 x i8>* %5, align 1
44  %index.next = add i64 %index, 8
45  %6 = icmp eq i64 %index.next, %end.idx.rnd.down
46  br i1 %6, label %for.end24, label %vector.body
47
48for.end24:
49  ret void
50}
51