59 lines · plain
1; Check that flattened profile lowering handles cold subgraphs that end in "unreachable"2; RUN: split-file %s %t3; RUN: llvm-ctxprof-util fromYAML --input=%t/profile.yaml --output=%t/profile.ctxprofdata4; RUN: opt -passes=ctx-prof-flatten %t/1234.ll -use-ctx-profile=%t/profile.ctxprofdata -S -o - | FileCheck %s5 6; CHECK-LABEL: entry:7; CHECK: br i1 %t, label %yes, label %no, !prof ![[C1:[0-9]+]]8; CHECK-LABEL: no:9; CHECK-NOT: !prof10; CHECK-LABEL: no1:11; CHECK-NOT: !prof12; CHECK-LABEL: no2:13; CHECK-NOT: !prof14; CHECK-LABEL: yes:15; CHECK: br i1 %t3, label %yes1, label %yes2, !prof ![[C1]]16; CHECK-NOT: !prof17; CHECK: ![[C1]] = !{!"branch_weights", i32 72, i32 0}18 19;--- 1234.ll20define void @f1(i32 %cond) !guid !0 {21entry:22 call void @llvm.instrprof.increment(ptr @f1, i64 42, i32 42, i32 0)23 %t = icmp eq i32 %cond, 124 br i1 %t, label %yes, label %no25 26no:27 %t2 = icmp eq i32 %cond, 228 br i1 %t2, label %no1, label %no229no1:30 unreachable31no2:32 call void @llvm.instrprof.increment(ptr @f1, i64 42, i32 42, i32 1)33 unreachable34yes:35 %t3 = icmp eq i32 %cond, 336 br i1 %t3, label %yes1, label %yes237yes1:38 br label %exit39yes2:40 call void @llvm.instrprof.increment(ptr @f1, i64 42, i32 42, i32 2)41 %t4 = icmp eq i32 %cond, 442 br i1 %t4, label %yes3, label %yes443yes3:44 br label %exit45yes4:46 call void @llvm.instrprof.increment(ptr @f1, i64 42, i32 42, i32 3)47 unreachable48exit:49 ret void50}51 52!0 = !{i64 1234}53 54;--- profile.yaml55Contexts:56 - Guid: 123457 TotalRootEntryCount: 1258 Counters: [6,0,0,0]59