Add a test for PR10565.
[oota-llvm.git] / test / Transforms / IndVarSimplify / variable-stride-ivs-1.ll
1 ; RUN: opt < %s -indvars
2 ; PR4315
3
4 target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128"
5 target triple = "x86_64-undermydesk-freebsd8.0"
6         %struct.mbuf = type <{ %struct.mbuf*, i8*, i32, i8, i8, i8, i8 }>
7
8 define i32 @crash(%struct.mbuf* %m) nounwind {
9 entry:
10         br label %for.cond
11
12 for.cond:               ; preds = %if.end, %entry
13         %i.0 = phi i32 [ 0, %entry ], [ %inc, %if.end ]         ; <i32> [#uses=3]
14         %chksum.0 = phi i8 [ 0, %entry ], [ %conv3, %if.end ]           ; <i8> [#uses=3]
15         %cmp = icmp slt i32 %i.0, 1             ; <i1> [#uses=1]
16         br i1 %cmp, label %for.body, label %do.body
17
18 for.body:               ; preds = %for.cond
19         br i1 undef, label %if.end, label %do.body
20
21 if.end:         ; preds = %for.body
22         %i.02 = trunc i32 %i.0 to i8            ; <i8> [#uses=1]
23         %conv3 = add i8 %chksum.0, %i.02                ; <i8> [#uses=1]
24         %inc = add i32 %i.0, 1          ; <i32> [#uses=1]
25         br label %for.cond
26
27 do.body:                ; preds = %do.cond, %for.body, %for.cond
28         %chksum.2 = phi i8 [ undef, %do.cond ], [ %chksum.0, %for.body ], [ %chksum.0, %for.cond ]              ; <i8> [#uses=1]
29         br i1 undef, label %do.cond, label %bb.nph
30
31 bb.nph:         ; preds = %do.body
32         br label %while.body
33
34 while.body:             ; preds = %while.body, %bb.nph
35         %chksum.13 = phi i8 [ undef, %while.body ], [ %chksum.2, %bb.nph ]              ; <i8> [#uses=0]
36         br i1 undef, label %do.cond, label %while.body
37
38 do.cond:                ; preds = %while.body, %do.body
39         br i1 false, label %do.end, label %do.body
40
41 do.end:         ; preds = %do.cond
42         ret i32 0
43 }