1; RUN: opt < %s -passes=pgo-instr-gen -S | FileCheck %s --check-prefixes=CHECK,GEN 2; RUN: opt < %s -passes=pgo-instr-gen,instrprof -S | FileCheck %s --check-prefixes=CHECK,LOWER 3 4target datalayout = "e-m:e-p:32:32-i64:64-n32:64-S128" 5target triple = "wasm32-unknown-unknown" 6 7define void @wasm_funclet_op_bundle(ptr %p, ptr %dst, ptr %src) personality ptr @__gxx_wasm_personality_v0 { 8entry: 9 invoke void @foo() 10 to label %try.cont unwind label %catch.dispatch 11 12catch.dispatch: ; preds = %entry 13 %0 = catchswitch within none [label %catch.start] unwind to caller 14 15catch.start: ; preds = %catch.dispatch 16 %1 = catchpad within %0 [ptr null] 17; CHECK: %[[CATCHPAD:.*]] = catchpad 18 %2 = call ptr @llvm.wasm.get.exception(token %1) 19 %3 = call i32 @llvm.wasm.get.ehselector(token %1) 20 %4 = call ptr @__cxa_begin_catch(ptr %2) #3 [ "funclet"(token %1) ] 21 %tmp = load i32, ptr %p, align 4 22 call void @llvm.memcpy.p0.p0.i32(ptr %dst, ptr %src, i32 %tmp, i1 false) 23; GEN: call void @llvm.instrprof.value.profile({{.*}}) [ "funclet"(token %[[CATCHPAD]]) ] 24; LOWER: call void @__llvm_profile_instrument_memop({{.*}}) [ "funclet"(token %[[CATCHPAD]]) ] 25 call void @__cxa_end_catch() [ "funclet"(token %1) ] 26 catchret from %1 to label %try.cont 27 28try.cont: ; preds = %catch.start, %entry 29 ret void 30} 31 32declare void @foo() 33declare i32 @__gxx_wasm_personality_v0(...) 34; Function Attrs: nocallback nofree nosync nounwind willreturn 35declare ptr @llvm.wasm.get.exception(token) #0 36; Function Attrs: nocallback nofree nosync nounwind willreturn 37declare i32 @llvm.wasm.get.ehselector(token) #0 38; Function Attrs: nounwind memory(none) 39declare i32 @llvm.eh.typeid.for(ptr) #1 40declare ptr @__cxa_begin_catch(ptr) 41declare void @__cxa_end_catch() 42; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite) 43declare void @llvm.memcpy.p0.p0.i32(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i32, i1 immarg) #2 44 45attributes #0 = { nocallback nofree nosync nounwind willreturn } 46attributes #1 = { nounwind memory(none) } 47attributes #2 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) } 48attributes #3 = { nounwind } 49