File: instrprof_simple_sampling.ll

package info (click to toggle)
llvm-toolchain-19 1%3A19.1.7-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,998,520 kB
  • sloc: cpp: 6,951,680; ansic: 1,486,157; asm: 913,598; python: 232,024; f90: 80,126; objc: 75,281; lisp: 37,276; pascal: 16,990; sh: 10,009; ml: 5,058; perl: 4,724; awk: 3,523; makefile: 3,167; javascript: 2,504; xml: 892; fortran: 664; cs: 573
file content (60 lines) | stat: -rw-r--r-- 2,973 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 5
; RUN: opt < %s --passes=instrprof --sampled-instrumentation --sampled-instr-burst-duration=1 --sampled-instr-period=1009 -S | FileCheck %s --check-prefix=PERIOD1009
; RUN: opt < %s --passes=instrprof --sampled-instrumentation --sampled-instr-burst-duration=1 -S | FileCheck %s --check-prefix=DEFAULTPERIOD

target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

$__llvm_profile_raw_version = comdat any

@__llvm_profile_raw_version = constant i64 72057594037927940, comdat
@__profn_f = private constant [1 x i8] c"f"

define void @f() {
; PERIOD1009-LABEL: define void @f() {
; PERIOD1009-NEXT:  [[ENTRY:.*:]]
; PERIOD1009-NEXT:    [[TMP0:%.*]] = load i16, ptr @__llvm_profile_sampling, align 2
; PERIOD1009-NEXT:    [[TMP1:%.*]] = add i16 [[TMP0]], 1
; PERIOD1009-NEXT:    [[TMP2:%.*]] = icmp uge i16 [[TMP1]], 1009
; PERIOD1009-NEXT:    br i1 [[TMP2]], label %[[BB3:.*]], label %[[BB5:.*]], !prof [[PROF0:![0-9]+]]
; PERIOD1009:       [[BB3]]:
; PERIOD1009-NEXT:    [[PGOCOUNT:%.*]] = load i64, ptr @__profc_f, align 8
; PERIOD1009-NEXT:    [[TMP4:%.*]] = add i64 [[PGOCOUNT]], 1
; PERIOD1009-NEXT:    store i64 [[TMP4]], ptr @__profc_f, align 8
; PERIOD1009-NEXT:    store i16 0, ptr @__llvm_profile_sampling, align 2
; PERIOD1009-NEXT:    br label %[[BB6:.*]]
; PERIOD1009:       [[BB5]]:
; PERIOD1009-NEXT:    store i16 [[TMP1]], ptr @__llvm_profile_sampling, align 2
; PERIOD1009-NEXT:    br label %[[BB6]]
; PERIOD1009:       [[BB6]]:
; PERIOD1009-NEXT:    ret void
;
; DEFAULTPERIOD-LABEL: define void @f() {
; DEFAULTPERIOD-NEXT:  [[ENTRY:.*:]]
; DEFAULTPERIOD-NEXT:    [[TMP0:%.*]] = load i16, ptr @__llvm_profile_sampling, align 2
; DEFAULTPERIOD-NEXT:    [[TMP1:%.*]] = add i16 [[TMP0]], 1
; DEFAULTPERIOD-NEXT:    [[TMP2:%.*]] = icmp uge i16 [[TMP1]], -1
; DEFAULTPERIOD-NEXT:    br i1 [[TMP2]], label %[[BB3:.*]], label %[[BB5:.*]], !prof [[PROF0:![0-9]+]]
; DEFAULTPERIOD:       [[BB3]]:
; DEFAULTPERIOD-NEXT:    [[PGOCOUNT:%.*]] = load i64, ptr @__profc_f, align 8
; DEFAULTPERIOD-NEXT:    [[TMP4:%.*]] = add i64 [[PGOCOUNT]], 1
; DEFAULTPERIOD-NEXT:    store i64 [[TMP4]], ptr @__profc_f, align 8
; DEFAULTPERIOD-NEXT:    store i16 0, ptr @__llvm_profile_sampling, align 2
; DEFAULTPERIOD-NEXT:    br label %[[BB6:.*]]
; DEFAULTPERIOD:       [[BB5]]:
; DEFAULTPERIOD-NEXT:    store i16 [[TMP1]], ptr @__llvm_profile_sampling, align 2
; DEFAULTPERIOD-NEXT:    br label %[[BB6]]
; DEFAULTPERIOD:       [[BB6]]:
; DEFAULTPERIOD-NEXT:    ret void
;
entry:
  call void @llvm.instrprof.increment(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @__profn_f, i32 0, i32 0), i64 12884901887, i32 1, i32 0)
  ret void
}

declare void @llvm.instrprof.increment(i8*, i64, i32, i32)
;.
; PERIOD1009: [[PROF0]] = !{!"branch_weights", i32 1, i32 1009}
;.
; DEFAULTPERIOD: [[PROF0]] = !{!"branch_weights", i32 1, i32 65535}
;.