• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: opt < %s -pgo-instr-gen -S | FileCheck %s --check-prefix=GEN --check-prefix=GEN-COMDAT
2; RUN: opt < %s -mtriple=x86_64-apple-darwin -pgo-instr-gen -S | FileCheck %s --check-prefix=GEN --check-prefix=GEN-DARWIN-LINKONCE
3
4; New PM
5; RUN: opt < %s -passes=pgo-instr-gen -S | FileCheck %s --check-prefix=GEN --check-prefix=GEN-COMDAT
6; RUN: opt < %s -mtriple=x86_64-apple-darwin -passes=pgo-instr-gen -S | FileCheck %s --check-prefix=GEN --check-prefix=GEN-DARWIN-LINKONCE
7
8; RUN: llvm-profdata merge %S/Inputs/branch1.proftext -o %t.profdata
9; RUN: opt < %s -pgo-instr-use -pgo-test-profile-file=%t.profdata -S | FileCheck %s --check-prefix=USE
10
11; New PM
12; RUN: opt < %s -passes=pgo-instr-use -pgo-test-profile-file=%t.profdata -S | FileCheck %s --check-prefix=USE
13
14target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
15target triple = "x86_64-unknown-linux-gnu"
16; GEN-DARWIN-LINKONCE: target triple = "x86_64-apple-darwin"
17
18; GEN-COMDAT: $__llvm_profile_raw_version = comdat any
19; GEN-COMDAT: @__llvm_profile_raw_version = constant i64 {{[0-9]+}}, comdat
20; GEN-LINKONCE: @__llvm_profile_raw_version = linkonce constant i64 {{[0-9]+}}
21; GEN: @__profn_test_br_1 = private constant [9 x i8] c"test_br_1"
22
23define i32 @test_br_1(i32 %i) {
24; USE-LABEL: @test_br_1
25; USE-SAME: !prof ![[FUNC_ENTRY_COUNT:[0-9]+]]
26entry:
27; GEN: entry:
28; GEN-NOT: llvm.instrprof.increment
29  %cmp = icmp sgt i32 %i, 0
30  br i1 %cmp, label %if.then, label %if.end
31; USE: br i1 %cmp, label %if.then, label %if.end
32; USE-SAME: !prof ![[BW_ENTRY:[0-9]+]]
33; USE-DAG: ![[BW_ENTRY]] = !{!"branch_weights", i32 2, i32 1}
34
35if.then:
36; GEN: if.then:
37; GEN: call void @llvm.instrprof.increment(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @__profn_test_br_1, i32 0, i32 0), i64 25571299074, i32 2, i32 1)
38  %add = add nsw i32 %i, 2
39  br label %if.end
40
41if.end:
42; GEN: if.end:
43; GEN: call void @llvm.instrprof.increment(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @__profn_test_br_1, i32 0, i32 0), i64 25571299074, i32 2, i32 0)
44  %retv = phi i32 [ %add, %if.then ], [ %i, %entry ]
45  ret i32 %retv
46}
47; USE-DAG: {{![0-9]+}} = !{i32 1, !"ProfileSummary", {{![0-9]+}}}
48; USE-DAG: {{![0-9]+}} = !{!"DetailedSummary", {{![0-9]+}}}
49; USE-DAG: ![[FUNC_ENTRY_COUNT]] = !{!"function_entry_count", i64 3}
50