1 ; RUN: opt < %s -loop-unswitch -loop-unswitch-threshold=0 -verify-loop-info -S < %s 2>&1 | FileCheck %s 2 3 ; This test contains two trivial unswitch condition in one loop. 4 ; LoopUnswitch pass should be able to unswitch the second one 5 ; after unswitching the first one. 6 7 8 ; CHECK: br i1 %cond1, label %..split_crit_edge, label %.loop_exit.split_crit_edge 9 10 ; CHECK: ..split_crit_edge: ; preds = %0 11 ; CHECK: br label %.split 12 13 ; CHECK: .split: ; preds = %..split_crit_edge 14 ; CHECK: br i1 %cond2, label %.split..split.split_crit_edge, label %.split.loop_exit.split1_crit_edge 15 16 ; CHECK: .split..split.split_crit_edge: ; preds = %.split 17 ; CHECK: br label %.split.split 18 19 ; CHECK: .split.split: ; preds = %.split..split.split_crit_edge 20 ; CHECK: br label %loop_begin 21 22 ; CHECK: loop_begin: ; preds = %do_something, %.split.split 23 ; CHECK: br i1 true, label %continue, label %loop_exit 24 25 ; CHECK: continue: ; preds = %loop_begin 26 ; CHECK: %var_val = load i32, i32* %var 27 ; CHECK: br i1 true, label %do_something, label %loop_exit 28 29 define i32 @test(i32* %var, i1 %cond1, i1 %cond2) { 30 br label %loop_begin 31 32 loop_begin: 33 br i1 %cond1, label %continue, label %loop_exit ; first trivial condition 34 35 continue: 36 %var_val = load i32, i32* %var 37 br i1 %cond2, label %do_something, label %loop_exit ; second trivial condition 38 39 do_something: 40 call void @some_func() noreturn nounwind 41 br label %loop_begin 42 43 loop_exit: 44 ret i32 0 45 } 46 47 declare void @some_func() noreturn