1 ; RUN: opt -S -indvars < %s | FileCheck %s
3 target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
4 target triple = "x86_64-apple-macosx10.11.0"
6 define i32 @somefunc(double* %arr) {
7 ; CHECK-LABEL: @somefunc(
9 br label %for.cond.1.preheader
11 for.cond.1.preheader: ; preds = %for.inc.9, %entry
12 %index3.013 = phi i32 [ 0, %entry ], [ %index3.1.lcssa, %for.inc.9 ]
13 %index.012 = phi i32 [ 0, %entry ], [ %inc10, %for.inc.9 ]
14 %cmp2.9 = icmp sgt i32 %index.012, 0
15 br i1 %cmp2.9, label %for.body.3.lr.ph, label %for.inc.9
17 for.body.3.lr.ph: ; preds = %for.cond.1.preheader
18 %idxprom5 = sext i32 %index.012 to i64
21 for.body.3: ; preds = %for.body.3, %for.body.3.lr.ph
22 %index3.111 = phi i32 [ %index3.013, %for.body.3.lr.ph ], [ %inc, %for.body.3 ]
23 %index2.010 = phi i32 [ 0, %for.body.3.lr.ph ], [ %inc8, %for.body.3 ]
24 %inc = add nsw i32 %index3.111, 1
25 %idxprom = sext i32 %index3.111 to i64
26 %arrayidx = getelementptr inbounds double, double* %arr, i64 %idxprom
27 %idxprom4 = sext i32 %index2.010 to i64
28 %inc8 = add nsw i32 %index2.010, 1
29 %cmp2 = icmp slt i32 %inc8, %index.012
30 br i1 %cmp2, label %for.body.3, label %for.inc.9.loopexit
32 for.inc.9.loopexit: ; preds = %for.body.3
33 %inc.lcssa = phi i32 [ %inc, %for.body.3 ]
36 for.inc.9: ; preds = %for.inc.9.loopexit, %for.cond.1.preheader
37 %index3.1.lcssa = phi i32 [ %index3.013, %for.cond.1.preheader ], [ %inc.lcssa, %for.inc.9.loopexit ]
38 %inc10 = add nsw i32 %index.012, 1
39 %cmp = icmp slt i32 %inc10, 10
40 br i1 %cmp, label %for.cond.1.preheader, label %for.end.11
42 for.end.11: ; preds = %for.inc.9