1; This testcase comes from this C fragment:
2;
3; void test(unsigned Num, int *Array) {
4;  unsigned i, j, k;
5;
6;  for (i = 0; i != Num; ++i)
7;    for (j = 0; j != Num; ++j)
8;      for (k = 0; k != Num; ++k)
9;        printf("%d\n", i+k+j);    /* Reassociate to (i+j)+k */
10;}
11;
12; In this case, we want to reassociate the specified expr so that i+j can be
13; hoisted out of the inner most loop.
14;
15; RUN: opt < %s -reassociate -S | grep 115 | not grep 117
16; END.
17@.LC0 = internal global [4 x i8] c"%d\0A\00"		; <[4 x i8]*> [#uses=1]
18
19declare i32 @printf(i8*, ...)
20
21; FIXME: No longer works.
22define void @test(i32 %Num, i32* %Array) {
23bb0:
24	%cond221 = icmp eq i32 0, %Num		; <i1> [#uses=3]
25	br i1 %cond221, label %bb7, label %bb2
26bb2:		; preds = %bb6, %bb0
27	%reg115 = phi i32 [ %reg120, %bb6 ], [ 0, %bb0 ]		; <i32> [#uses=2]
28	br i1 %cond221, label %bb6, label %bb3
29bb3:		; preds = %bb5, %bb2
30	%reg116 = phi i32 [ %reg119, %bb5 ], [ 0, %bb2 ]		; <i32> [#uses=2]
31	br i1 %cond221, label %bb5, label %bb4
32bb4:		; preds = %bb4, %bb3
33	%reg117 = phi i32 [ %reg118, %bb4 ], [ 0, %bb3 ]		; <i32> [#uses=2]
34	%reg113 = add i32 %reg115, %reg117		; <i32> [#uses=1]
35	%reg114 = add i32 %reg113, %reg116		; <i32> [#uses=1]
36	%cast227 = getelementptr [4 x i8], [4 x i8]* @.LC0, i64 0, i64 0		; <i8*> [#uses=1]
37	call i32 (i8*, ...) @printf( i8* %cast227, i32 %reg114 )		; <i32>:0 [#uses=0]
38	%reg118 = add i32 %reg117, 1		; <i32> [#uses=2]
39	%cond224 = icmp ne i32 %reg118, %Num		; <i1> [#uses=1]
40	br i1 %cond224, label %bb4, label %bb5
41bb5:		; preds = %bb4, %bb3
42	%reg119 = add i32 %reg116, 1		; <i32> [#uses=2]
43	%cond225 = icmp ne i32 %reg119, %Num		; <i1> [#uses=1]
44	br i1 %cond225, label %bb3, label %bb6
45bb6:		; preds = %bb5, %bb2
46	%reg120 = add i32 %reg115, 1		; <i32> [#uses=2]
47	%cond226 = icmp ne i32 %reg120, %Num		; <i1> [#uses=1]
48	br i1 %cond226, label %bb2, label %bb7
49bb7:		; preds = %bb6, %bb0
50	ret void
51}
52