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