57 lines · plain
1; Note: Make sure that instrumention intrinsic is after entry alloca.2; RUN: opt < %s -passes=pgo-instr-gen -S | FileCheck %s3; RUN: opt < %s -passes=pgo-instr-gen,instrprof -sampled-instrumentation -S | FileCheck %s --check-prefixes=SAMPLE4 5%struct.A = type { i32, [0 x i32] }6%struct.B = type { i32, [0 x double] }7 8; CHECK-LABEL: @foo()9; CHECK-NEXT: %1 = alloca %struct.A10; CHECK-NEXT: %2 = alloca %struct.B11; CHECK-NEXT: call void @llvm.instrprof.increment(ptr @__profn_foo12 13; SAMPLE: @foo()14; SAMPLE-NEXT: %1 = alloca %struct.A15; SAMPLE-NEXT: %2 = alloca %struct.B16; SAMPLE-NEXT: %[[v:[0-9]+]] = load i16, ptr @__llvm_profile_sampling17; SAMPLE-NEXT: {{.*}} = icmp ule i16 %[[v]], 19918 19define dso_local double @foo() {20 %1 = alloca %struct.A, align 421 %2 = alloca %struct.B, align 822 call void @llvm.lifetime.start.p0(ptr nonnull %1)23 call void @llvm.lifetime.start.p0(ptr nonnull %2)24 call void @bar(ptr noundef nonnull %1, ptr noundef nonnull %2)25 %3 = load i32, ptr %1, align 426 %4 = icmp sgt i32 %3, 027 br i1 %4, label %5, label %2128 295:30 %6 = getelementptr inbounds i8, ptr %1, i64 431 %7 = getelementptr inbounds i8, ptr %2, i64 832 %8 = zext nneg i32 %3 to i6433 br label %934 359:36 %10 = phi i64 [ 0, %5 ], [ %19, %9 ]37 %11 = phi double [ 0.000000e+00, %5 ], [ %18, %9 ]38 %12 = getelementptr inbounds [0 x i32], ptr %6, i64 0, i64 %1039 %13 = load i32, ptr %12, align 440 %14 = sitofp i32 %13 to double41 %15 = getelementptr inbounds [0 x double], ptr %7, i64 0, i64 %1042 %16 = load double, ptr %15, align 843 %17 = fadd double %16, %1444 %18 = fadd double %11, %1745 %19 = add nuw nsw i64 %10, 146 %20 = icmp eq i64 %19, %847 br i1 %20, label %21, label %948 4921:50 %22 = phi double [ 0.000000e+00, %0 ], [ %18, %9 ]51 call void @llvm.lifetime.end.p0(ptr nonnull %2)52 call void @llvm.lifetime.end.p0(ptr nonnull %1)53 ret double %2254}55 56declare void @bar(ptr noundef, ptr noundef)57