1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 5 2; RUN: opt < %s --passes=instrprof --sampled-instrumentation --sampled-instr-burst-duration=1 --sampled-instr-period=1009 -S | FileCheck %s --check-prefix=PERIOD1009 3; RUN: opt < %s --passes=instrprof --sampled-instrumentation --sampled-instr-burst-duration=1 -S | FileCheck %s --check-prefix=DEFAULTPERIOD 4 5target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" 6target triple = "x86_64-unknown-linux-gnu" 7 8$__llvm_profile_raw_version = comdat any 9 10@__llvm_profile_raw_version = constant i64 72057594037927940, comdat 11@__profn_f = private constant [1 x i8] c"f" 12 13define void @f() { 14; PERIOD1009-LABEL: define void @f() { 15; PERIOD1009-NEXT: [[ENTRY:.*:]] 16; PERIOD1009-NEXT: [[TMP0:%.*]] = load i16, ptr @__llvm_profile_sampling, align 2 17; PERIOD1009-NEXT: [[TMP1:%.*]] = add i16 [[TMP0]], 1 18; PERIOD1009-NEXT: [[TMP2:%.*]] = icmp uge i16 [[TMP1]], 1009 19; PERIOD1009-NEXT: br i1 [[TMP2]], label %[[BB3:.*]], label %[[BB5:.*]], !prof [[PROF0:![0-9]+]] 20; PERIOD1009: [[BB3]]: 21; PERIOD1009-NEXT: [[PGOCOUNT:%.*]] = load i64, ptr @__profc_f, align 8 22; PERIOD1009-NEXT: [[TMP4:%.*]] = add i64 [[PGOCOUNT]], 1 23; PERIOD1009-NEXT: store i64 [[TMP4]], ptr @__profc_f, align 8 24; PERIOD1009-NEXT: store i16 0, ptr @__llvm_profile_sampling, align 2 25; PERIOD1009-NEXT: br label %[[BB6:.*]] 26; PERIOD1009: [[BB5]]: 27; PERIOD1009-NEXT: store i16 [[TMP1]], ptr @__llvm_profile_sampling, align 2 28; PERIOD1009-NEXT: br label %[[BB6]] 29; PERIOD1009: [[BB6]]: 30; PERIOD1009-NEXT: ret void 31; 32; DEFAULTPERIOD-LABEL: define void @f() { 33; DEFAULTPERIOD-NEXT: [[ENTRY:.*:]] 34; DEFAULTPERIOD-NEXT: [[TMP0:%.*]] = load i32, ptr @__llvm_profile_sampling, align 4 35; DEFAULTPERIOD-NEXT: [[TMP1:%.*]] = add i32 [[TMP0]], 1 36; DEFAULTPERIOD-NEXT: [[TMP2:%.*]] = icmp uge i32 [[TMP1]], 65536 37; DEFAULTPERIOD-NEXT: br i1 [[TMP2]], label %[[BB3:.*]], label %[[BB5:.*]], !prof [[PROF0:![0-9]+]] 38; DEFAULTPERIOD: [[BB3]]: 39; DEFAULTPERIOD-NEXT: [[PGOCOUNT:%.*]] = load i64, ptr @__profc_f, align 8 40; DEFAULTPERIOD-NEXT: [[TMP4:%.*]] = add i64 [[PGOCOUNT]], 1 41; DEFAULTPERIOD-NEXT: store i64 [[TMP4]], ptr @__profc_f, align 8 42; DEFAULTPERIOD-NEXT: store i32 0, ptr @__llvm_profile_sampling, align 4 43; DEFAULTPERIOD-NEXT: br label %[[BB6:.*]] 44; DEFAULTPERIOD: [[BB5]]: 45; DEFAULTPERIOD-NEXT: store i32 [[TMP1]], ptr @__llvm_profile_sampling, align 4 46; DEFAULTPERIOD-NEXT: br label %[[BB6]] 47; DEFAULTPERIOD: [[BB6]]: 48; DEFAULTPERIOD-NEXT: ret void 49; 50entry: 51 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) 52 ret void 53} 54 55declare void @llvm.instrprof.increment(i8*, i64, i32, i32) 56;. 57; PERIOD1009: [[PROF0]] = !{!"branch_weights", i32 1, i32 1008} 58;. 59; DEFAULTPERIOD: [[PROF0]] = !{!"branch_weights", i32 1, i32 65535} 60;. 61