1 ; RUN: opt < %s -passes=indvars
4 target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128"
5 target triple = "i386-apple-darwin10.0"
6 %struct.xyz = type <{ i64, i64, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i64, [8 x i8], i64, i64, i32, i32, [4 x i32], i32, i32, i32, i32, i32, i32, [76 x i32], i32, [2 x %struct.uvw] }>
7 %struct.uvw = type <{ i64, i64 }>
9 define i32 @foo(ptr %header, ptr %p2, ptr %p3, ptr nocapture %p4, i1 %arg) nounwind {
11 br label %while.body.i
13 while.body.i: ; preds = %while.body.i, %entry
14 br i1 %arg, label %while.body.i, label %bcopy_internal.exit
16 bcopy_internal.exit: ; preds = %while.body.i
17 %conv135 = ptrtoint ptr %header to i32 ; <i32> [#uses=1]
18 %shr136 = lshr i32 %conv135, 12 ; <i32> [#uses=1]
21 for.body: ; preds = %for.body, %bcopy_internal.exit
22 %ppnum.052 = phi i32 [ %inc, %for.body ], [ %shr136, %bcopy_internal.exit ] ; <i32> [#uses=1]
23 %inc = add i32 %ppnum.052, 1 ; <i32> [#uses=2]
24 %cmp = icmp ugt i32 %inc, undef ; <i1> [#uses=1]
25 br i1 %cmp, label %if.then199, label %for.body
27 if.then199: ; preds = %if.then199, %for.body
31 define i32 @same_thing_but_signed(ptr %header, ptr %p2, ptr %p3, ptr nocapture %p4, i1 %arg) nounwind {
33 br label %while.body.i
35 while.body.i: ; preds = %while.body.i, %entry
36 br i1 %arg, label %while.body.i, label %bcopy_internal.exit
38 bcopy_internal.exit: ; preds = %while.body.i
39 %conv135 = ptrtoint ptr %header to i32 ; <i32> [#uses=1]
40 %shr136 = ashr i32 %conv135, 12 ; <i32> [#uses=1]
43 for.body: ; preds = %for.body, %bcopy_internal.exit
44 %ppnum.052 = phi i32 [ %inc, %for.body ], [ %shr136, %bcopy_internal.exit ] ; <i32> [#uses=1]
45 %inc = add i32 %ppnum.052, 1 ; <i32> [#uses=2]
46 %cmp = icmp ugt i32 %inc, undef ; <i1> [#uses=1]
47 br i1 %cmp, label %if.then199, label %for.body
49 if.then199: ; preds = %if.then199, %for.body
53 define i32 @same_thing_but_multiplied(ptr %header, ptr %p2, ptr %p3, ptr nocapture %p4, i1 %arg) nounwind {
55 br label %while.body.i
57 while.body.i: ; preds = %while.body.i, %entry
58 br i1 %arg, label %while.body.i, label %bcopy_internal.exit
60 bcopy_internal.exit: ; preds = %while.body.i
61 %conv135 = ptrtoint ptr %header to i32 ; <i32> [#uses=1]
62 %shr136 = shl i32 %conv135, 12 ; <i32> [#uses=1]
65 for.body: ; preds = %for.body, %bcopy_internal.exit
66 %ppnum.052 = phi i32 [ %inc, %for.body ], [ %shr136, %bcopy_internal.exit ] ; <i32> [#uses=1]
67 %inc = add i32 %ppnum.052, 1 ; <i32> [#uses=2]
68 %cmp = icmp ugt i32 %inc, undef ; <i1> [#uses=1]
69 br i1 %cmp, label %if.then199, label %for.body
71 if.then199: ; preds = %if.then199, %for.body
75 define i32 @same_thing_but_xored(ptr %header, ptr %p2, ptr %p3, ptr nocapture %p4, i1 %arg) nounwind {
77 br label %while.body.i
79 while.body.i: ; preds = %while.body.i, %entry
80 br i1 %arg, label %while.body.i, label %bcopy_internal.exit
82 bcopy_internal.exit: ; preds = %while.body.i
83 %conv135 = ptrtoint ptr %header to i32 ; <i32> [#uses=1]
84 %shr136 = xor i32 %conv135, 12 ; <i32> [#uses=1]
87 for.body: ; preds = %for.body, %bcopy_internal.exit
88 %ppnum.052 = phi i32 [ %inc, %for.body ], [ %shr136, %bcopy_internal.exit ] ; <i32> [#uses=1]
89 %inc = add i32 %ppnum.052, 1 ; <i32> [#uses=2]
90 %cmp = icmp ugt i32 %inc, undef ; <i1> [#uses=1]
91 br i1 %cmp, label %if.then199, label %for.body
93 if.then199: ; preds = %if.then199, %for.body