46 lines · plain
1; RUN: opt < %s -S -passes=inline | FileCheck %s2; RUN: opt < %s -S -passes='cgscc(inline)' | FileCheck %s3 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 !18 ret i32 %sel9}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 %ret14 15; CHECK-LABEL: @caller_of_select(16; CHECK-NEXT: [[SEL:%.*]] = select i1 %C, i32 %A, i32 %B, !prof !0, !unpredictable !117; 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 !224if:25 ret i32 126else:27 ret i32 228}29 30define i32 @caller_of_branch(i1 %C) {31 %ret = call i32 @callee_with_branch(i1 %C)32 ret i32 %ret33 34; CHECK-LABEL: @caller_of_branch(35; CHECK-NEXT: br i1 %C, label %{{.*}}, label %{{.*}}, !prof !2, !unpredictable !136}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