brintos

brintos / llvm-project-archived public Read only

0
0
Text · 4.4 KiB · 98d0f02 Raw
90 lines · plain
1; RUN: llc < %s -O0 --filetype=obj -o - | llvm-dwarfdump - | FileCheck %s --check-prefixes DBG_USE2 3target triple = "wasm32-unknown-unknown"4 5declare i32 @extern_func(i32, i32)6 7; We want to produce WASM local "DW_OP_WASM_location 0x00 <local number>" locations8; in debug code instead of operand stack ("DW_OP_WASM_location 0x02 <depth>") locations9; since local locations are more widely supported and can cover the entirety of the method.10; DBG_USE: DW_TAG_subprogram11; DBG_USE:   DW_AT_name ("single_non_dbg_use")12; DBG_USE:   DW_TAG_variable13; DBG_USE:     DW_AT_location14; DBG_USE:       DW_OP_WASM_location 0x015; DBG_USE:     DW_AT_name    ("call_value")16; DBG_USE:   DW_TAG_variable17; DBG_USE:     DW_AT_location18; DBG_USE:       DW_OP_WASM_location 0x019; DBG_USE:     DW_AT_name    ("sub_value")20define i32 @single_non_dbg_use(i32 %0, i32 %1) !dbg !6 {21  %call_value = call i32 @extern_func(i32 1, i32 2), !dbg !2022  call void @llvm.dbg.value(metadata i32 %call_value, metadata !11, metadata !DIExpression()), !dbg !2023  %div = udiv i32 %0, %1, !dbg !2124  %sub = sub i32 %call_value, %div, !dbg !2225  call void @llvm.dbg.value(metadata i32 %sub, metadata !12, metadata !DIExpression()), !dbg !2226  ret i32 %sub, !dbg !2327}28 29!6 = distinct !DISubprogram(name: "single_non_dbg_use", scope: !1, file: !1, type: !7, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !0)30!7 = !DISubroutineType(types: !8)31!8 = !{!9, !9, !9}32!9 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)33!11 = !DILocalVariable(name: "call_value", scope: !6, type: !9)34!12 = !DILocalVariable(name: "sub_value", scope: !6, type: !9)35!20 = !DILocation(line: 20, scope: !6)36!21 = !DILocation(line: 21, scope: !6)37!22 = !DILocation(line: 22, scope: !6)38!23 = !DILocation(line: 23, scope: !6)39 40; Similarly for a singly-used frame base.41; DBG_USE: DW_TAG_subprogram42; DBG_USE:   DW_AT_frame_base (DW_OP_WASM_location 0x043; DBG_USE:   DW_AT_name ("single_use_frame_base")44; DBG_USE:   DW_TAG_variable45; DBG_USE:     DW_AT_location (DW_OP_fbreg +12)46; DBG_USE:     DW_AT_name ("arg_value")47define i32 @single_use_frame_base(i32 %0, i32 %1) !dbg !13 {48  %arg_loc = alloca i32, !dbg !2449  store i32 %1, ptr %arg_loc, !dbg !2550  call void @llvm.dbg.declare(metadata ptr %arg_loc, metadata !14, metadata !DIExpression()), !dbg !2551  ret i32 %0, !dbg !2652}53 54!13 = distinct !DISubprogram(name: "single_use_frame_base", scope: !1, file: !1, type: !7, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !0)55!14 = !DILocalVariable(name: "arg_value", scope: !13, type: !9)56!24 = !DILocation(line: 24, scope: !13)57!25 = !DILocation(line: 25, scope: !13)58!26 = !DILocation(line: 26, scope: !13)59 60; Similarly for multivalue defs... But we can't really test61; it due to https://github.com/llvm/llvm-project/issues/136506.62; declare {i32, i32} @extern_func_multivalue(i32, i32)63; 64; define i32 @single_non_dbg_use_multivalue(i32 %0, i32 %1) !dbg !15 {65;   %full_value = call {i32, i32} @extern_func_multivalue(i32 1, i32 2), !dbg !2766;   %full_value_one = extractvalue {i32, i32} %full_value, 0, !dbg !2767;   %full_value_two = extractvalue {i32, i32} %full_value, 1, !dbg !2768;   %partial_value = call {i32, i32} @extern_func_multivalue(i32 %full_value_one, i32 %full_value_two), !dbg !2869;   call void @llvm.dbg.value(metadata i32 %full_value_two, metadata !16, metadata !DIExpression()), !dbg !2870;   %partial_value_one = extractvalue {i32, i32} %partial_value, 0, !dbg !2871;   %partial_value_two = extractvalue {i32, i32} %partial_value, 1, !dbg !2872;   call void @llvm.dbg.value(metadata i32 %partial_value_two, metadata !17, metadata !DIExpression()), !dbg !2873;   ret i32 %partial_value_one, !dbg !2974; }75; 76; !15 = distinct !DISubprogram(name: "single_non_dbg_use_multivalue", scope: !1, file: !1, type: !7, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !0)77; !16 = !DILocalVariable(name: "value_used", scope: !15, type: !9)78; !17 = !DILocalVariable(name: "value_unused", scope: !15, type: !9)79; !27 = !DILocation(line: 27, scope: !15)80; !28 = !DILocation(line: 28, scope: !15)81; !29 = !DILocation(line: 29, scope: !15)82 83!llvm.dbg.cu = !{!0}84!llvm.module.flags = !{!2, !3}85 86!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus_14, file: !1, producer: "LLC", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, splitDebugInlining: false, nameTableKind: None)87!1 = !DIFile(filename: "test.ll", directory: "")88!2 = !{i32 7, !"Dwarf Version", i32 4}89!3 = !{i32 2, !"Debug Info Version", i32 3}90