66 lines · plain
1 2; RUN: opt < %s -passes=pgo-instr-gen -S | FileCheck %s --check-prefix=GEN3; RUN: opt < %s -passes=pgo-instr-gen,instrprof -S | FileCheck %s --check-prefix=LOWER4 5; This test is to verify that PGO runtime library calls get created with the6; appropriate operand bundle funclet information when an indirect call7; was marked with as belonging to a particular funclet.8 9; Test case based on this source:10; extern void may_throw(int);11;12; class base {13; public:14; base() : x(0) {};15; int get_x() const { return x; }16; virtual void update() { x++; }17; int x;18; };19;20; class derived : public base {21; public:22; derived() {}23; virtual void update() { x--; }24; };25;26; void run(base* b, int count) {27; try {28; may_throw(count);29; }30; catch (...) {31; // Virtual function call in exception handler for value profiling.32; b->update();33; }34; }35 36%class.base = type { ptr, i32 }37define dso_local void @"?run@@YAXPEAVbase@@H@Z"(ptr %b, i32 %count) personality ptr @__CxxFrameHandler3 {38entry:39 invoke void @"?may_throw@@YAXH@Z"(i32 %count)40 to label %try.cont unwind label %catch.dispatch41 42catch.dispatch: ; preds = %entry43 %tmp = catchswitch within none [label %catch] unwind to caller44 45catch: ; preds = %catch.dispatch46 %tmp1 = catchpad within %tmp [ptr null, i32 64, ptr null]47 %vtable = load ptr, ptr %b, align 848 %tmp3 = load ptr, ptr %vtable, align 849 call void %tmp3(ptr %b) [ "funclet"(token %tmp1) ]50 catchret from %tmp1 to label %try.cont51 52try.cont: ; preds = %catch, %entry53 ret void54}55 56; GEN: catch:57; GEN: call void @llvm.instrprof.value.profile(58; GEN-SAME: [ "funclet"(token %tmp1) ]59 60; LOWER: catch:61; LOWER: call void @__llvm_profile_instrument_target(62; LOWER-SAME: [ "funclet"(token %tmp1) ]63 64declare dso_local void @"?may_throw@@YAXH@Z"(i32)65declare dso_local i32 @__CxxFrameHandler3(...)66