brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.6 KiB · 18fa1b9 Raw
46 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --check-globals --version 22; Test that hoisting conditional branches copies the debug and profiling info3; metadata from the branch being hoisted.4; RUN: opt -S -passes=licm %s -o - | FileCheck %s5 6declare i32 @foo()7 8; to_hoist should get hoisted, and that should not result9; in a loss of profiling info10define i32 @hoist_select(i1 %cond, i32 %a, i32 %b) nounwind {11; CHECK-LABEL: define i32 @hoist_select12; CHECK-SAME: (i1 [[COND:%.*]], i32 [[A:%.*]], i32 [[B:%.*]]) #[[ATTR0:[0-9]+]] {13; CHECK-NEXT:  entry:14; CHECK-NEXT:    [[TO_HOIST:%.*]] = select i1 [[COND]], i32 [[A]], i32 [[B]], !prof [[PROF0:![0-9]+]]15; CHECK-NEXT:    br label [[L0:%.*]]16; CHECK:       L0:17; CHECK-NEXT:    [[G:%.*]] = call i32 @foo()18; CHECK-NEXT:    [[SUM:%.*]] = add i32 [[G]], [[TO_HOIST]]19; CHECK-NEXT:    [[C:%.*]] = icmp eq i32 [[SUM]], 020; CHECK-NEXT:    br i1 [[C]], label [[L0]], label [[EXIT:%.*]], !prof [[PROF1:![0-9]+]]21; CHECK:       exit:22; CHECK-NEXT:    [[SUM_LCSSA:%.*]] = phi i32 [ [[SUM]], [[L0]] ]23; CHECK-NEXT:    ret i32 [[SUM_LCSSA]]24;25entry:26  br label %L027L0:28  %g = call i32 @foo()29  %to_hoist = select i1 %cond, i32 %a, i32 %b, !prof !030  %sum = add i32 %g, %to_hoist31  %c = icmp eq i32 %sum, 032  br i1 %c, label %L0, label %exit, !prof !133 34exit:35  ret i32 %sum36}37 38!0 = !{!"branch_weights", i32 2, i32 5}39!1 = !{!"branch_weights", i32 101, i32 189}40;.41; CHECK: attributes #[[ATTR0]] = { nounwind }42;.43; CHECK: [[PROF0]] = !{!"branch_weights", i32 2, i32 5}44; CHECK: [[PROF1]] = !{!"branch_weights", i32 101, i32 189}45;.46