|
| 1 | +; RUN: llc %s -stop-after wasm-cfg-stackify -o - | FileCheck %s |
| 2 | + |
| 3 | +; The test ensures "block" instruction is not inserted in the middle of a group |
| 4 | +; of instructions that form a stackified expression when DBG_VALUE is present |
| 5 | +; among them. |
| 6 | + |
| 7 | +; CHECK: body: |
| 8 | +; CHECK: BLOCK |
| 9 | +; <-- Stackified expression starts |
| 10 | +; CHECK-NEXT: GET_LOCAL_I64 |
| 11 | +; CHECK-NEXT: I32_WRAP_I64 |
| 12 | +; CHECK-NEXT: DBG_VALUE |
| 13 | +; <-- BLOCK should NOT be placed here! |
| 14 | +; CHECK-NEXT: BR_UNLESS |
| 15 | +; <-- Stackified expression ends |
| 16 | + |
| 17 | +target triple = "wasm32-unknown-unknown" |
| 18 | + |
| 19 | +define void @foo(i64 %arg) { |
| 20 | +start: |
| 21 | + %val = trunc i64 %arg to i32 |
| 22 | + %cmp = icmp eq i32 %val, 0 |
| 23 | + call void @llvm.dbg.value(metadata i32 %val, metadata !46, metadata !DIExpression()), !dbg !105 |
| 24 | + br i1 %cmp, label %bb2, label %bb1 |
| 25 | +bb1: ; preds = %start |
| 26 | + call void @bar() |
| 27 | + br label %bb2 |
| 28 | +bb2: ; preds = %bb1, start |
| 29 | + ret void |
| 30 | +} |
| 31 | + |
| 32 | +declare void @bar() |
| 33 | +declare void @llvm.dbg.value(metadata, metadata, metadata) |
| 34 | + |
| 35 | +!llvm.dbg.cu = !{!0} |
| 36 | +!llvm.module.flags = !{!33} |
| 37 | +!0 = distinct !DICompileUnit(language: DW_LANG_Rust, file: !6, producer: "clang LLVM (rustc version 1.30.0-dev)", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, globals: !2) |
| 38 | +!2 = !{} |
| 39 | +!6 = !DIFile(filename: "<unknown>", directory: "") |
| 40 | +!22 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "&str", file: !6, size: 64, align: 32, elements: !{}, identifier: "111094d970b097647de579f9c509ef08") |
| 41 | +!33 = !{i32 2, !"Debug Info Version", i32 3} |
| 42 | +!35 = distinct !DILexicalBlock(scope: !37, file: !6, line: 357, column: 8) |
| 43 | +!37 = distinct !DISubprogram(name: "foobar", linkageName: "_fooba", scope: !38, file: !6, line: 353, type: !39, isLocal: true, isDefinition: true, scopeLine: 353, flags: DIFlagPrototyped, isOptimized: true, unit: !0, templateParams: !2, retainedNodes: !42) |
| 44 | +!38 = !DINamespace(name: "ptr", scope: null) |
| 45 | +!39 = !DISubroutineType(types: !2) |
| 46 | +!42 = !{!46} |
| 47 | +!46 = !DILocalVariable(name: "z", scope: !35, file: !6, line: 357, type: !22, align: 4) |
| 48 | +!105 = !DILocation(line: 357, column: 12, scope: !35) |
0 commit comments