• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; Test that instrumentaiton works fine for the case of failing the split critical edges.
2; RUN: opt < %s -pgo-instr-gen -S | FileCheck %s --check-prefix=GEN
3; RUN: opt < %s -passes=pgo-instr-gen -S | FileCheck %s --check-prefix=GEN
4; RUN: llvm-profdata merge %S/Inputs/PR41279.proftext -o %t.profdata
5; RUN: opt < %s -pgo-instr-use -pgo-test-profile-file=%t.profdata -S | FileCheck %s --check-prefix=USE
6; RUN: opt < %s -passes=pgo-instr-use -pgo-test-profile-file=%t.profdata -S | FileCheck %s --check-prefix=USE
7
8declare void @f3({ i8*, i64 }*, { i8*, i64 }*, i64)
9declare { i8*, i64 } @f0({ i8*, i64 }*)
10declare i64 @f1()
11declare void @invok2({ i8*, i64 }*, i8* noalias readonly align 1, i64)
12declare void @invok1({ i8*, i64 }*, { i8*, i64 }*, i64)
13declare i32 @__CxxFrameHandler3(...)
14
15define void @foo({ i8*, i64 }*, { i8*, i64 }*) personality i32 (...)* @__CxxFrameHandler3 {
16; USE-LABEL: @foo
17; USE-SAME: !prof ![[FUNC_ENTRY_COUNT:[0-9]+]]
18
19  %3 = alloca i8, align 1
20  store i8 0, i8* %3, align 1
21  %4 = call i64 @f1()
22  %5 = icmp ult i64 %4, 32
23  br i1 %5, label %7, label %13
24; USE: br i1 %5, label %7, label %13
25; USE-SAME: !prof ![[BW_ENTRY1:[0-9]+]]
26
276:
28  cleanupret from %17 unwind to caller
29; GEN: 6:
30; GEN:  call void @llvm.instrprof.increment(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @__profn_foo, i32 0, i32 0), i64 {{[0-9]+}}, i32 4, i32 2)
31
327:
33  store i8 1, i8* %3, align 1
34  %8 = call { i8*, i64 } @f0({ i8*, i64 }* %0)
35  %9 = extractvalue { i8*, i64 } %8, 0
36  %10 = extractvalue { i8*, i64 } %8, 1
37  invoke void @invok1({ i8*, i64 }* %1, { i8*, i64 }* %0, i64 1)
38          to label %11 unwind label %16
39; GEN: 7:
40; GEN-NOT: call void @llvm.instrprof.increment
41
4211:
43  store i8 0, i8* %3, align 1
44  invoke void @invok2({ i8*, i64 }* %1, i8* noalias readonly align 1 %9, i64 %10)
45          to label %12 unwind label %16
46; GEN: 11:
47; GEN-NOT: call void @llvm.instrprof.increment
48
4912:
50  store i8 0, i8* %3, align 1
51  br label %14
52; GEN: 12:
53; GEN:  call void @llvm.instrprof.increment(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @__profn_foo, i32 0, i32 0), i64 {{[0-9]+}}, i32 4, i32 1)
54
5513:
56  call void @f3({ i8*, i64 }* %0, { i8*, i64 }* %1, i64 1)
57  br label %14
58; GEN: 13:
59; GEN:  call void @llvm.instrprof.increment(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @__profn_foo, i32 0, i32 0), i64 {{[0-9]+}}, i32 4, i32 0)
60
6114:
62  ret void
63
6415:
65  store i8 0, i8* %3, align 1
66  br label %6
67; GEN: 15:
68; GEN:  call void @llvm.instrprof.increment(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @__profn_foo, i32 0, i32 0), i64 {{[0-9]+}}, i32 4, i32 3)
69
7016:
71  %17 = cleanuppad within none []
72  %18 = load i8, i8* %3, align 1
73  %19 = trunc i8 %18 to i1
74  br i1 %19, label %15, label %6
75; USE: br i1 %19, label %15, label %6
76; USE-SAME: !prof ![[BW_ENTRY2:[0-9]+]]
77}
78
79; USE-DAG: {{![0-9]+}} = !{i32 1, !"ProfileSummary", {{![0-9]+}}}
80; USE-DAG: {{![0-9]+}} = !{!"DetailedSummary", {{![0-9]+}}}
81; USE-DAG: ![[FUNC_ENTRY_COUNT]] = !{!"function_entry_count", i64 8}
82; USE_DAG: ![[BW_ENTRY1]] = !{!"branch_weights", i32 5, i32 3}
83; USE_DAG: ![[BW_ENTRY2]] = !{!"branch_weights", i32 2, i32 1}
84
85