| ; RUN: opt -S -passes=dxil-debug-info %s -o - | FileCheck %s |
| ; RUN: llc %s -o - | FileCheck %s --check-prefixes=CHECK,CHECK-COMMENT |
| ; RUN: opt -S -passes=dxil-debug-info %s -o - | FileCheck %s --check-prefix=NO-DUP |
| |
| target triple = "dxil-unknown-shadermodel6.3-library" |
| |
| ;; @x is optimized away. DIGLobalVariable stays, but its variable operand is null (not printed). |
| ;; @y is not optimized away. |
| |
| @x = global i32 0, align 4, !dbg !0 |
| @y = global i32 1, align 4, !dbg !2 |
| |
| define void @foo() { |
| %y = load i32, ptr @y |
| ret void |
| } |
| |
| ; CHECK-DAG: !llvm.dbg.cu = !{![[CU:[0-9]+]]} |
| ; CHECK-DAG: ![[CU]] = distinct !DICompileUnit(language: DW_LANG_C, file: ![[FILE:[0-9]+]], producer: "handwritten", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, globals: ![[GLOBALS:[0-9]+]], splitDebugInlining: false, nameTableKind: Apple, sysroot: "/") |
| ; CHECK-DAG: ![[GLOBALS]] = !{![[GVEX:[0-9]+]], ![[GVEY:[0-9]+]]} |
| ; CHECK-DAG: ![[GVEX]] = !DIGlobalVariableExpression(var: ![[GVX:[0-9]+]], expr: !DIExpression()) |
| ; CHECK-COMMENT-DAG: DXIL: ![[GVEX]]: to be replaced by: ![[GVX]] |
| ; CHECK-DAG: ![[GVX]] = !DIGlobalVariable(name: "x", scope: ![[CU]], file: ![[FILE]], line: 1, type: ![[TYPE:[0-9]+]], isLocal: false, isDefinition: true) |
| ; CHECK-DAG: ![[GVEY]] = !DIGlobalVariableExpression(var: ![[GVY:[0-9]+]], expr: !DIExpression()) |
| ; CHECK-COMMENT-DAG: DXIL: ![[GVEY]]: to be replaced by: ![[GVY]] |
| ; CHECK-DAG: ![[GVY]] = !DIGlobalVariable(name: "y", scope: ![[CU]], file: ![[FILE]], line: 1, type: ![[TYPE:[0-9]+]], isLocal: false, isDefinition: true) |
| ; CHECK-COMMENT-DAG: DXIL: ![[GVY]]: additional data: ptr @y |
| ; CHECK-DAG: ![[FILE]] = !DIFile(filename: "cu.cpp", directory: "/tmp") |
| ; CHECK-DAG: ![[TYPE]] = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed) |
| |
| ; NO-DUP: ![[GVX:[0-9]+]] = !DIGlobalVariable(name: "x" |
| ; NO-DUP-NOT: ![[GVX]] = |
| ; NO-DUP: ![[GVY:[0-9]+]] = !DIGlobalVariable(name: "y" |
| ; NO-DUP-NOT: ![[GVY]] = |
| |
| !llvm.dbg.cu = !{!4} |
| !llvm.module.flags = !{!8, !9} |
| |
| !0 = !DIGlobalVariableExpression(var: !1, expr: !DIExpression()) |
| !1 = !DIGlobalVariable(name: "x", scope: !4, file: !5, line: 1, type: !7, isLocal: false, isDefinition: true) |
| !2 = !DIGlobalVariableExpression(var: !3, expr: !DIExpression()) |
| !3 = !DIGlobalVariable(name: "y", scope: !4, file: !5, line: 1, type: !7, isLocal: false, isDefinition: true) |
| !4 = distinct !DICompileUnit(language: DW_LANG_C, file: !5, producer: "handwritten", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, globals: !6, splitDebugInlining: false, nameTableKind: Apple, sysroot: "/") |
| !5 = !DIFile(filename: "cu.cpp", directory: "/tmp") |
| !6 = !{!0, !2} |
| !7 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed) |
| !8 = !{i32 7, !"Dwarf Version", i32 5} |
| !9 = !{i32 2, !"Debug Info Version", i32 3} |