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-period=1009 --sampled-instr-burst-duration=32 -S | FileCheck %s --check-prefixes=CHECK,CHECK-32 3; RUN: opt < %s --passes=instrprof -sampled-instrumentation --sampled-instr-period=1009 --sampled-instr-burst-duration=1009 -S | FileCheck %s --check-prefixes=CHECK,CHECK-UNSAMPLED 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; CHECK-LABEL: define void @f() { 15; CHECK-NEXT: [[ENTRY:.*:]] 16; CHECK-NEXT: [[TMP0:%.*]] = load i16, ptr @__llvm_profile_sampling, align 2 17; CHECK-32-NEXT: [[TMP1:%.*]] = icmp ule i16 [[TMP0]], 31 18; CHECK-UNSAMPLED-NEXT: [[TMP1:%.*]] = icmp ule i16 [[TMP0]], 1008 19; CHECK-NEXT: br i1 [[TMP1]], label %[[BB2:.*]], label %[[BB4:.*]], !prof [[PROF0:![0-9]+]] 20; CHECK: [[BB2]]: 21; CHECK-NEXT: [[PGOCOUNT:%.*]] = load i64, ptr @__profc_f, align 8 22; CHECK-NEXT: [[TMP3:%.*]] = add i64 [[PGOCOUNT]], 1 23; CHECK-NEXT: store i64 [[TMP3]], ptr @__profc_f, align 8 24; CHECK-NEXT: br label %[[BB4]] 25; CHECK: [[BB4]]: 26; CHECK-NEXT: [[TMP5:%.*]] = add i16 [[TMP0]], 1 27; CHECK-NEXT: [[TMP6:%.*]] = icmp uge i16 [[TMP5]], 1009 28; CHECK-NEXT: br i1 [[TMP6]], label %[[BB7:.*]], label %[[BB8:.*]], !prof [[PROF1:![0-9]+]] 29; CHECK: [[BB7]]: 30; CHECK-NEXT: store i16 0, ptr @__llvm_profile_sampling, align 2 31; CHECK-NEXT: br label %[[BB9:.*]] 32; CHECK: [[BB8]]: 33; CHECK-NEXT: store i16 [[TMP5]], ptr @__llvm_profile_sampling, align 2 34; CHECK-NEXT: br label %[[BB9]] 35; CHECK: [[BB9]]: 36; CHECK-NEXT: ret void 37; 38entry: 39 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) 40 ret void 41} 42 43declare void @llvm.instrprof.increment(i8*, i64, i32, i32) 44;. 45; CHECK-32: [[PROF0]] = !{!"branch_weights", i32 32, i32 977} 46; CHECK-32: [[PROF1]] = !{!"branch_weights", i32 1, i32 1008} 47; CHECK-UNSAMPLED: [[PROF0]] = !{!"branch_weights", i32 1009, i32 0} 48; CHECK-UNSAMPLED: [[PROF1]] = !{!"branch_weights", i32 1, i32 1008} 49;. 50