1; RUN: opt < %s -S -inline | FileCheck %s 2; RUN: opt < %s -S -passes='cgscc(inline)' | FileCheck %s 3 4; Make sure that profile and unpredictable metadata is preserved when cloning a select. 5 6define i32 @callee_with_select(i1 %c, i32 %a, i32 %b) { 7 %sel = select i1 %c, i32 %a, i32 %b, !prof !0, !unpredictable !1 8 ret i32 %sel 9} 10 11define i32 @caller_of_select(i1 %C, i32 %A, i32 %B) { 12 %ret = call i32 @callee_with_select(i1 %C, i32 %A, i32 %B) 13 ret i32 %ret 14 15; CHECK-LABEL: @caller_of_select( 16; CHECK-NEXT: [[SEL:%.*]] = select i1 %C, i32 %A, i32 %B, !prof !0, !unpredictable !1 17; CHECK-NEXT: ret i32 [[SEL]] 18} 19 20; Make sure that profile and unpredictable metadata is preserved when cloning a branch. 21 22define i32 @callee_with_branch(i1 %c) { 23 br i1 %c, label %if, label %else, !unpredictable !1, !prof !2 24if: 25 ret i32 1 26else: 27 ret i32 2 28} 29 30define i32 @caller_of_branch(i1 %C) { 31 %ret = call i32 @callee_with_branch(i1 %C) 32 ret i32 %ret 33 34; CHECK-LABEL: @caller_of_branch( 35; CHECK-NEXT: br i1 %C, label %{{.*}}, label %{{.*}}, !prof !2, !unpredictable !1 36} 37 38!0 = !{!"branch_weights", i32 1, i32 2} 39!1 = !{} 40!2 = !{!"branch_weights", i32 3, i32 4} 41 42; CHECK: !0 = !{!"branch_weights", i32 1, i32 2} 43; CHECK: !1 = !{} 44; CHECK: !2 = !{!"branch_weights", i32 3, i32 4} 45 46