blob: 75574c07c0e805fe65d88606f233379c19aa6639 [file] [log] [blame]
Tanya Lattnere6d5d392008-03-19 07:28:33 +00001; RUN: llvm-as < %s | opt -loop-reduce -disable-output
Chris Lattner8fa14272005-08-16 00:36:12 +00002
Tanya Lattnere6d5d392008-03-19 07:28:33 +00003define void @try_swap() {
Chris Lattner8fa14272005-08-16 00:36:12 +00004entry:
Tanya Lattnere6d5d392008-03-19 07:28:33 +00005 br i1 false, label %cond_continue.0.i, label %cond_false.0.i
Chris Lattner8fa14272005-08-16 00:36:12 +00006cond_false.0.i: ; preds = %entry
7 ret void
Chris Lattner8fa14272005-08-16 00:36:12 +00008cond_continue.0.i: ; preds = %entry
Tanya Lattnere6d5d392008-03-19 07:28:33 +00009 br i1 false, label %cond_continue.1.i, label %cond_false.1.i
Chris Lattner8fa14272005-08-16 00:36:12 +000010cond_false.1.i: ; preds = %cond_continue.0.i
11 ret void
Chris Lattner8fa14272005-08-16 00:36:12 +000012cond_continue.1.i: ; preds = %cond_continue.0.i
Tanya Lattnere6d5d392008-03-19 07:28:33 +000013 br i1 false, label %endif.3.i, label %else.0.i
Chris Lattner8fa14272005-08-16 00:36:12 +000014endif.3.i: ; preds = %cond_continue.1.i
Tanya Lattnere6d5d392008-03-19 07:28:33 +000015 br i1 false, label %my_irand.exit82, label %endif.0.i62
Chris Lattner8fa14272005-08-16 00:36:12 +000016else.0.i: ; preds = %cond_continue.1.i
17 ret void
Chris Lattner8fa14272005-08-16 00:36:12 +000018endif.0.i62: ; preds = %endif.3.i
19 ret void
Chris Lattner8fa14272005-08-16 00:36:12 +000020my_irand.exit82: ; preds = %endif.3.i
Tanya Lattnere6d5d392008-03-19 07:28:33 +000021 br i1 false, label %else.2, label %then.4
Chris Lattner8fa14272005-08-16 00:36:12 +000022then.4: ; preds = %my_irand.exit82
23 ret void
Chris Lattner8fa14272005-08-16 00:36:12 +000024else.2: ; preds = %my_irand.exit82
Tanya Lattnere6d5d392008-03-19 07:28:33 +000025 br i1 false, label %find_affected_nets.exit, label %loopentry.1.i107.outer.preheader
Chris Lattner8fa14272005-08-16 00:36:12 +000026loopentry.1.i107.outer.preheader: ; preds = %else.2
27 ret void
Chris Lattner8fa14272005-08-16 00:36:12 +000028find_affected_nets.exit: ; preds = %else.2
Tanya Lattnere6d5d392008-03-19 07:28:33 +000029 br i1 false, label %save_region_occ.exit, label %loopentry.1
Chris Lattner8fa14272005-08-16 00:36:12 +000030save_region_occ.exit: ; preds = %find_affected_nets.exit
Tanya Lattnere6d5d392008-03-19 07:28:33 +000031 br i1 false, label %no_exit.1.preheader, label %loopexit.1
Chris Lattner8fa14272005-08-16 00:36:12 +000032loopentry.1: ; preds = %find_affected_nets.exit
33 ret void
Chris Lattner8fa14272005-08-16 00:36:12 +000034no_exit.1.preheader: ; preds = %save_region_occ.exit
35 ret void
Chris Lattner8fa14272005-08-16 00:36:12 +000036loopexit.1: ; preds = %save_region_occ.exit
Tanya Lattnere6d5d392008-03-19 07:28:33 +000037 br i1 false, label %then.10, label %loopentry.3
Chris Lattner8fa14272005-08-16 00:36:12 +000038then.10: ; preds = %loopexit.1
39 ret void
Chris Lattner8fa14272005-08-16 00:36:12 +000040loopentry.3: ; preds = %endif.16, %loopexit.1
Tanya Lattnere6d5d392008-03-19 07:28:33 +000041 %indvar342 = phi i32 [ %indvar.next343, %endif.16 ], [ 0, %loopexit.1 ] ; <i32> [#uses=2]
42 br i1 false, label %loopexit.3, label %endif.16
Chris Lattner8fa14272005-08-16 00:36:12 +000043endif.16: ; preds = %loopentry.3
Tanya Lattnere6d5d392008-03-19 07:28:33 +000044 %indvar.next343 = add i32 %indvar342, 1 ; <i32> [#uses=1]
Chris Lattner8fa14272005-08-16 00:36:12 +000045 br label %loopentry.3
Chris Lattner8fa14272005-08-16 00:36:12 +000046loopexit.3: ; preds = %loopentry.3
47 br label %loopentry.4
Chris Lattner8fa14272005-08-16 00:36:12 +000048loopentry.4: ; preds = %loopentry.4, %loopexit.3
Tanya Lattnere6d5d392008-03-19 07:28:33 +000049 %indvar340 = phi i32 [ 0, %loopexit.3 ], [ %indvar.next341, %loopentry.4 ] ; <i32> [#uses=2]
50 %tmp. = add i32 %indvar340, %indvar342 ; <i32> [#uses=1]
51 %tmp.526 = load i32** null ; <i32*> [#uses=1]
52 %gep.upgrd.1 = zext i32 %tmp. to i64 ; <i64> [#uses=1]
53 %tmp.528 = getelementptr i32* %tmp.526, i64 %gep.upgrd.1 ; <i32*> [#uses=1]
54 store i32 0, i32* %tmp.528
55 %indvar.next341 = add i32 %indvar340, 1 ; <i32> [#uses=1]
Chris Lattner8fa14272005-08-16 00:36:12 +000056 br label %loopentry.4
57}