59 lines · plain
1; RUN: opt < %s -wasm-lower-em-ehsjlj -enable-emscripten-sjlj -S | FileCheck %s2 3target datalayout = "e-m:e-p:32:32-i64:64-n32:64-S128"4target triple = "wasm32-unknown-unknown"5 6%struct.__jmp_buf_tag = type { [6 x i32], i32, [32 x i32] }7 8; Basic debug info test. All existing instructions have debug info and inserted9; 'malloc' and 'free' calls take debug info from the next instruction.10define void @setjmp_debug_info0() !dbg !3 {11; CHECK-LABEL: @setjmp_debug_info012entry:13 %buf = alloca [1 x %struct.__jmp_buf_tag], align 16, !dbg !414 %arraydecay = getelementptr inbounds [1 x %struct.__jmp_buf_tag], ptr %buf, i32 0, i32 0, !dbg !515 %call = call i32 @setjmp(ptr %arraydecay) #0, !dbg !616 call void @foo(), !dbg !717 ret void, !dbg !818; CHECK: entry:19 ; CHECK-NEXT: %buf = alloca [1 x %struct.__jmp_buf_tag], align 16, !dbg ![[DL0:.*]]20 ; CHECK-NEXT: %functionInvocationId = alloca i32, align 4, !dbg ![[DL0]]21 22; CHECK: entry.split:23 ; CHECK: call void @__wasm_setjmp{{.*}}, !dbg ![[DL1:.*]]24 ; CHECK-NEXT: br {{.*}}, !dbg ![[DL2:.*]]25 26; CHECK: entry.split.split:27 ; CHECK: call {{.*}} void @__invoke_void{{.*}}, !dbg ![[DL2]]28 29; CHECK: entry.split.split.split:30 31; CHECK: if.then1:32 ; CHECK: call i32 @__wasm_setjmp_test{{.*}}, !dbg ![[DL2]]33 34; CHECK: if.end:35 36; CHECK: call.em.longjmp:37 ; CHECK: call void @emscripten_longjmp{{.*}}, !dbg ![[DL2]]38 39; CHECK: if.end2:40 ; CHECK: call void @setTempRet0{{.*}}, !dbg ![[DL2]]41}42 43declare void @foo()44; Function Attrs: returns_twice45declare i32 @setjmp(ptr) #046 47!llvm.dbg.cu = !{!2}48!llvm.module.flags = !{!0}49 50!0 = !{i32 2, !"Debug Info Version", i32 3}51!1 = !DIFile(filename: "lower-em-sjlj.c", directory: "test")52!2 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1)53!3 = distinct !DISubprogram(name: "setjmp_debug_info0", unit:!2, file: !1, line: 1)54!4 = !DILocation(line:2, scope: !3)55!5 = !DILocation(line:3, scope: !3)56!6 = !DILocation(line:4, scope: !3)57!7 = !DILocation(line:5, scope: !3)58!8 = !DILocation(line:6, scope: !3)59