brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.3 KiB · 0e85afc Raw
71 lines · plain
1; RUN: opt < %s -passes=pgo-instr-gen -S | FileCheck %s --check-prefix=GEN2; RUN: opt < %s -passes=pgo-instr-gen,instrprof -S | FileCheck %s --check-prefixes=LOWER3 4; This test is to verify that PGO runtime library calls get created with the5; appropriate operand bundle funclet information when a memory intrinsic6; being value profiled is called within an exception handler.7 8; Test case based on this source:9;  #include <memory.h>10;11;  extern void may_throw(int);12;13;  #define MSG "0123456789012345\0"14;  unsigned len = 16;15;  char msg[200];16;17;  void run(int count) {18;    try {19;      may_throw(count);20;    }21;    catch (...) {22;      memcpy(msg, MSG, len);23;      throw;24;    }25;  }26 27%eh.ThrowInfo = type { i32, i32, i32, i32 }28 29$"??_C@_0BC@CABPINND@Exception?5caught?$AA?$AA@" = comdat any30 31@"?len@@3IA" = dso_local global i32 16, align 432@"?msg@@3PADA" = dso_local global [200 x i8] zeroinitializer, align 1633@"??_C@_0BC@CABPINND@Exception?5caught?$AA?$AA@" = linkonce_odr dso_local unnamed_addr constant [18 x i8] c"0123456789012345\00\00", comdat, align 134 35define dso_local void @"?run@@YAXH@Z"(i32 %count) personality ptr @__CxxFrameHandler3 {36entry:37  invoke void @"?may_throw@@YAXH@Z"(i32 %count)38          to label %try.cont unwind label %catch.dispatch39 40catch.dispatch:                                   ; preds = %entry41  %tmp = catchswitch within none [label %catch] unwind to caller42 43catch:                                            ; preds = %catch.dispatch44  %tmp1 = catchpad within %tmp [ptr null, i32 64, ptr null]45  %tmp2 = load i32, ptr @"?len@@3IA", align 446  %conv = zext i32 %tmp2 to i6447  call void @llvm.memcpy.p0.p0.i64(48    ptr @"?msg@@3PADA",49    ptr @"??_C@_0BC@CABPINND@Exception?5caught?$AA?$AA@",50    i64 %conv, i1 false)51  call void @_CxxThrowException(ptr null, ptr null) #3 [ "funclet"(token %tmp1) ]52  unreachable53 54try.cont:                                         ; preds = %entry55  ret void56}57 58; GEN: catch:59; GEN: call void @llvm.instrprof.value.profile(60; GEN-SAME: [ "funclet"(token %tmp1) ]61 62; LOWER: catch:63; LOWER: call void @__llvm_profile_instrument_memop(64; LOWER-SAME: [ "funclet"(token %tmp1) ]65 66declare dso_local void @"?may_throw@@YAXH@Z"(i32)67declare dso_local i32 @__CxxFrameHandler3(...)68 69declare void @llvm.memcpy.p0.p0.i64(ptr, ptr, i64, i1)70declare dso_local void @_CxxThrowException(ptr, ptr)71