|
| 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 | + |
| 4 | +target datalayout = "e-m:e-p:32:32-i64:64-n32:64-S128" |
| 5 | +target triple = "wasm32-unknown-unknown" |
| 6 | + |
| 7 | +define void @wasm_funclet_op_bundle(ptr %p, ptr %dst, ptr %src) personality ptr @__gxx_wasm_personality_v0 { |
| 8 | +entry: |
| 9 | + invoke void @foo() |
| 10 | + to label %try.cont unwind label %catch.dispatch |
| 11 | + |
| 12 | +catch.dispatch: ; preds = %entry |
| 13 | + %0 = catchswitch within none [label %catch.start] unwind to caller |
| 14 | + |
| 15 | +catch.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 | + |
| 28 | +try.cont: ; preds = %catch.start, %entry |
| 29 | + ret void |
| 30 | +} |
| 31 | + |
| 32 | +declare void @foo() |
| 33 | +declare i32 @__gxx_wasm_personality_v0(...) |
| 34 | +; Function Attrs: nocallback nofree nosync nounwind willreturn |
| 35 | +declare ptr @llvm.wasm.get.exception(token) #0 |
| 36 | +; Function Attrs: nocallback nofree nosync nounwind willreturn |
| 37 | +declare i32 @llvm.wasm.get.ehselector(token) #0 |
| 38 | +; Function Attrs: nounwind memory(none) |
| 39 | +declare i32 @llvm.eh.typeid.for(ptr) #1 |
| 40 | +declare ptr @__cxa_begin_catch(ptr) |
| 41 | +declare void @__cxa_end_catch() |
| 42 | +; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite) |
| 43 | +declare void @llvm.memcpy.p0.p0.i32(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i32, i1 immarg) #2 |
| 44 | + |
| 45 | +attributes #0 = { nocallback nofree nosync nounwind willreturn } |
| 46 | +attributes #1 = { nounwind memory(none) } |
| 47 | +attributes #2 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) } |
| 48 | +attributes #3 = { nounwind } |
0 commit comments