51 lines · plain
1; REQUIRES:x86_64-linux2 3; Test flattening indirect calls into "VP" MD_prof metadata, in prelink.4 5; RUN: split-file %s %t6; RUN: llvm-ctxprof-util fromYAML --input %t/profile.yaml --output %t/profile.ctxprofdata7; RUN: opt -passes=ctx-prof-flatten-prethinlink %t/example.ll -use-ctx-profile=%t/profile.ctxprofdata \8; RUN: -S -o - | FileCheck %s --check-prefix=PRELINK9 10; PRELINK: call void @llvm.instrprof.callsite(ptr @foo, i64 1234, i32 2, i32 0, ptr %p)11; PRELINK-NEXT: call void %p(), !prof ![[VPPROF:[0-9]+]]12; PRELINK-NEXT: call void @llvm.instrprof.callsite(ptr @foo, i64 1234, i32 2, i32 1, ptr @bar)13; PRELINK-NEXT: call void @bar(){{$}}14; PRELINK: ![[VPPROF]] = !{!"VP", i32 0, i64 25, i64 5678, i64 20, i64 5555, i64 5}15 16; RUN: cp %t/example.ll %t/1234.ll17; RUN: opt -passes=ctx-prof-flatten %t/1234.ll -use-ctx-profile=%t/profile.ctxprofdata \18; RUN: -S -o - | FileCheck %s --check-prefix=POSTLINK19; RUN: opt -passes=ctx-prof-flatten %t/example.ll -use-ctx-profile=%t/profile.ctxprofdata \20; RUN: -S -o - | FileCheck %s --check-prefix=POSTLINK21 22; POSTLINK-NOT: call void %p(), !prof23;--- example.ll24 25declare !guid !0 void @bar()26 27define void @foo(ptr %p) !guid !1 {28 call void @llvm.instrprof.increment(ptr @foo, i64 1234, i32 1, i32 0)29 call void @llvm.instrprof.callsite(ptr @foo, i64 1234, i32 2, i32 0, ptr %p)30 call void %p()31 call void @llvm.instrprof.callsite(ptr @foo, i64 1234, i32 2, i32 1, ptr @bar)32 call void @bar()33 ret void34}35 36!0 = !{i64 8888}37!1 = !{i64 1234}38 39;--- profile.yaml40Contexts:41 - Guid: 123442 TotalRootEntryCount: 543 Counters: [5]44 Callsites:45 - - Guid: 555546 Counters: [1]47 - Guid: 567848 Counters: [4]49 - - Guid: 888850 Counters: [5]51