1; RUN: opt < %s -loop-reduce -disable-output
2
3target 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"
4
5target triple = "i686-apple-darwin9"
6
7define i8* @foo( i8* %ABC) {
8entry:
9	switch i8 0, label %bb129 [
10		 i8 0, label %UnifiedReturnBlock
11		 i8 9, label %UnifiedReturnBlock
12		 i8 32, label %UnifiedReturnBlock
13		 i8 35, label %UnifiedReturnBlock
14		 i8 37, label %bb16.preheader
15	]
16
17bb16.preheader:		; preds = %entry
18	br label %bb16
19
20bb16:		; preds = %cond_next102, %bb16.preheader
21	%indvar = phi i32 [ %indvar.next, %cond_next102 ], [ 0, %bb16.preheader ]		; <i32> [#uses=2]
22	%ABC.2146.0.rec = mul i32 %indvar, 3		; <i32> [#uses=1]
23	br i1 false, label %UnifiedReturnBlock.loopexit, label %cond_next102
24
25cond_next102:		; preds = %bb16
26	%tmp138145.rec = add i32 %ABC.2146.0.rec, 3		; <i32> [#uses=1]
27	%tmp138145 = getelementptr i8* %ABC, i32 %tmp138145.rec		; <i8*> [#uses=4]
28	%indvar.next = add i32 %indvar, 1		; <i32> [#uses=1]
29	switch i8 0, label %bb129.loopexit [
30		 i8 0, label %UnifiedReturnBlock.loopexit
31		 i8 9, label %UnifiedReturnBlock.loopexit
32		 i8 32, label %UnifiedReturnBlock.loopexit
33		 i8 35, label %UnifiedReturnBlock.loopexit
34		 i8 37, label %bb16
35	]
36
37bb129.loopexit:		; preds = %cond_next102
38	br label %bb129
39
40bb129:		; preds = %bb129.loopexit, %entry
41	ret i8* null
42
43UnifiedReturnBlock.loopexit:		; preds = %cond_next102, %cond_next102, %cond_next102, %cond_next102, %bb16
44	%UnifiedRetVal.ph = phi i8* [ %tmp138145, %cond_next102 ], [ %tmp138145, %cond_next102 ], [ %tmp138145, %cond_next102 ], [ %tmp138145, %cond_next102 ], [ null, %bb16 ]		; <i8*> [#uses=0]
45	br label %UnifiedReturnBlock
46
47UnifiedReturnBlock:		; preds = %UnifiedReturnBlock.loopexit, %entry, %entry, %entry, %entry
48	ret i8* null
49}
50
51define i8* @bar() {
52entry:
53	switch i8 0, label %bb158 [
54		 i8 37, label %bb74
55		 i8 58, label %cond_true
56		 i8 64, label %bb11
57	]
58
59bb11:		; preds = %entry
60	ret i8* null
61
62cond_true:		; preds = %entry
63	ret i8* null
64
65bb74:		; preds = %entry
66	ret i8* null
67
68bb158:		; preds = %entry
69	ret i8* null
70}
71
72