1 ; RUN: opt < %s -loop-unswitch -loop-unswitch-with-block-frequency -S 2>&1 | FileCheck %s
3 ;; trivial condition should be unswithed regardless of coldness.
4 define i32 @test1(i1 %cond1, i1 %cond2) !prof !1 {
5 br i1 %cond1, label %loop_begin, label %loop_exit, !prof !0
8 ; CHECK: br i1 true, label %continue, label %loop_exit.loopexit
9 br i1 %cond2, label %continue, label %loop_exit ; trivial condition
12 call void @some_func1() noreturn nounwind
19 ;; cold non-trivial condition should not be unswitched.
20 define i32 @test2(i32* %var, i1 %cond1, i1 %cond2) !prof !1 {
21 br i1 %cond1, label %loop_begin, label %loop_exit, !prof !0
24 store i32 1, i32* %var
25 ; CHECK: br i1 %cond2, label %continue1, label %continue2
26 br i1 %cond2, label %continue1, label %continue2 ; non-trivial condition
29 call void @some_func1() noreturn nounwind
33 call void @some_func2() noreturn nounwind
37 ;; unswitching will duplicate these calls.
38 call void @some_func3() noreturn nounwind
39 call void @some_func4() noreturn nounwind
46 declare void @some_func1() noreturn
47 declare void @some_func2() noreturn
48 declare void @some_func3() noreturn
49 declare void @some_func4() noreturn
51 !0 = !{!"branch_weights", i32 1, i32 100000000}
52 !1 = !{!"function_entry_count", i64 100}