2017-10-19 07:18:12 +08:00
|
|
|
# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
|
2018-05-06 05:19:59 +08:00
|
|
|
# RUN: llc -O0 -mtriple arm64-- -run-pass=instruction-select %s -o - | FileCheck %s
|
2017-03-20 00:12:53 +08:00
|
|
|
|
|
|
|
--- |
|
|
|
|
target datalayout = "e-m:o-i64:64-i128:128-n32:64-S128"
|
|
|
|
|
2017-03-22 07:42:54 +08:00
|
|
|
define void @test_dbg_value(i32 %a) !dbg !5 {
|
|
|
|
%tmp0 = add i32 %a, %a
|
2017-08-24 04:31:27 +08:00
|
|
|
call void @llvm.dbg.value(metadata i32 %tmp0, i64 0, metadata !7, metadata !DIExpression()), !dbg !9
|
2017-03-22 07:42:54 +08:00
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
2017-08-24 04:31:27 +08:00
|
|
|
define void @test_dbg_value_dead(i32 %a) !dbg !10 {
|
|
|
|
call void @llvm.dbg.value(metadata i32 0, i64 0, metadata !11, metadata !DIExpression()), !dbg !12
|
2017-03-20 00:12:53 +08:00
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
|
|
|
declare void @llvm.dbg.value(metadata, i64, metadata, metadata)
|
|
|
|
|
|
|
|
!llvm.dbg.cu = !{!0}
|
|
|
|
!llvm.module.flags = !{!3, !4}
|
|
|
|
|
|
|
|
!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "llvm", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !2)
|
|
|
|
!1 = !DIFile(filename: "test.ll", directory: "/tmp")
|
|
|
|
!2 = !{}
|
|
|
|
!3 = !{i32 2, !"Dwarf Version", i32 4}
|
|
|
|
!4 = !{i32 2, !"Debug Info Version", i32 3}
|
[DebugInfo] Add DILabel metadata and intrinsic llvm.dbg.label.
In order to set breakpoints on labels and list source code around
labels, we need collect debug information for labels, i.e., label
name, the function label belong, line number in the file, and the
address label located. In order to keep these information in LLVM
IR and to allow backend to generate debug information correctly.
We create a new kind of metadata for labels, DILabel. The format
of DILabel is
!DILabel(scope: !1, name: "foo", file: !2, line: 3)
We hope to keep debug information as much as possible even the
code is optimized. So, we create a new kind of intrinsic for label
metadata to avoid the metadata is eliminated with basic block.
The intrinsic will keep existing if we keep it from optimized out.
The format of the intrinsic is
llvm.dbg.label(metadata !1)
It has only one argument, that is the DILabel metadata. The
intrinsic will follow the label immediately. Backend could get the
label metadata through the intrinsic's parameter.
We also create DIBuilder API for labels to be used by Frontend.
Frontend could use createLabel() to allocate DILabel objects, and use
insertLabel() to insert llvm.dbg.label intrinsic in LLVM IR.
Differential Revision: https://reviews.llvm.org/D45024
Patch by Hsiangkai Wang.
llvm-svn: 331841
2018-05-09 10:40:45 +08:00
|
|
|
!5 = distinct !DISubprogram(name: "test_dbg_value", scope: !1, file: !1, line: 1, type: !6, isLocal: false, isDefinition: true, scopeLine: 1, flags: DIFlagPrototyped, isOptimized: false, unit: !0, retainedNodes: !2)
|
2017-03-20 00:12:53 +08:00
|
|
|
!6 = !DISubroutineType(types: !2)
|
|
|
|
!7 = !DILocalVariable(name: "in", arg: 1, scope: !5, file: !1, line: 1, type: !8)
|
|
|
|
!8 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
|
2017-08-24 04:31:27 +08:00
|
|
|
!9 = !DILocation(line: 1, column: 1, scope: !5)
|
[DebugInfo] Add DILabel metadata and intrinsic llvm.dbg.label.
In order to set breakpoints on labels and list source code around
labels, we need collect debug information for labels, i.e., label
name, the function label belong, line number in the file, and the
address label located. In order to keep these information in LLVM
IR and to allow backend to generate debug information correctly.
We create a new kind of metadata for labels, DILabel. The format
of DILabel is
!DILabel(scope: !1, name: "foo", file: !2, line: 3)
We hope to keep debug information as much as possible even the
code is optimized. So, we create a new kind of intrinsic for label
metadata to avoid the metadata is eliminated with basic block.
The intrinsic will keep existing if we keep it from optimized out.
The format of the intrinsic is
llvm.dbg.label(metadata !1)
It has only one argument, that is the DILabel metadata. The
intrinsic will follow the label immediately. Backend could get the
label metadata through the intrinsic's parameter.
We also create DIBuilder API for labels to be used by Frontend.
Frontend could use createLabel() to allocate DILabel objects, and use
insertLabel() to insert llvm.dbg.label intrinsic in LLVM IR.
Differential Revision: https://reviews.llvm.org/D45024
Patch by Hsiangkai Wang.
llvm-svn: 331841
2018-05-09 10:40:45 +08:00
|
|
|
!10 = distinct !DISubprogram(name: "test_dbg_value", scope: !1, file: !1, line: 1, type: !6, isLocal: false, isDefinition: true, scopeLine: 1, flags: DIFlagPrototyped, isOptimized: false, unit: !0, retainedNodes: !2)
|
2017-08-24 04:31:27 +08:00
|
|
|
!11 = !DILocalVariable(name: "in", arg: 1, scope: !10, file: !1, line: 1, type: !8)
|
|
|
|
!12 = !DILocation(line: 1, column: 1, scope: !10)
|
2017-03-20 00:12:53 +08:00
|
|
|
...
|
|
|
|
|
|
|
|
---
|
|
|
|
name: test_dbg_value
|
|
|
|
legalized: true
|
|
|
|
regBankSelected: true
|
2017-03-22 07:42:54 +08:00
|
|
|
body: |
|
|
|
|
bb.0:
|
2018-02-01 06:04:26 +08:00
|
|
|
liveins: $w0
|
2017-10-19 07:18:12 +08:00
|
|
|
; CHECK-LABEL: name: test_dbg_value
|
2018-02-01 06:04:26 +08:00
|
|
|
; CHECK: [[COPY:%[0-9]+]]:gpr32 = COPY $w0
|
2017-10-25 02:04:54 +08:00
|
|
|
; CHECK: [[ADDWrr:%[0-9]+]]:gpr32 = ADDWrr [[COPY]], [[COPY]]
|
2018-02-01 06:04:26 +08:00
|
|
|
; CHECK: $w0 = COPY [[ADDWrr]]
|
2018-10-31 07:28:27 +08:00
|
|
|
; CHECK: DBG_VALUE [[ADDWrr]], $noreg, !7, !DIExpression(), debug-location !9
|
2018-02-01 06:04:26 +08:00
|
|
|
%0:gpr(s32) = COPY $w0
|
2017-03-22 07:42:54 +08:00
|
|
|
%1:gpr(s32) = G_ADD %0, %0
|
2018-02-01 06:04:26 +08:00
|
|
|
$w0 = COPY %1(s32)
|
2018-10-31 07:28:27 +08:00
|
|
|
DBG_VALUE %1(s32), $noreg, !7, !DIExpression(), debug-location !9
|
2017-03-22 07:42:54 +08:00
|
|
|
...
|
|
|
|
|
|
|
|
---
|
|
|
|
name: test_dbg_value_dead
|
|
|
|
legalized: true
|
|
|
|
regBankSelected: true
|
2017-03-20 00:12:53 +08:00
|
|
|
body: |
|
|
|
|
bb.0:
|
2018-02-01 06:04:26 +08:00
|
|
|
liveins: $w0
|
2017-10-19 07:18:12 +08:00
|
|
|
; CHECK-LABEL: name: test_dbg_value_dead
|
2017-03-22 07:42:54 +08:00
|
|
|
; CHECK-NOT: COPY
|
2018-10-31 07:28:27 +08:00
|
|
|
; CHECK: DBG_VALUE $noreg, $noreg, !7, !DIExpression(), debug-location !9
|
2018-02-01 06:04:26 +08:00
|
|
|
%0:gpr(s32) = COPY $w0
|
2018-10-31 07:28:27 +08:00
|
|
|
DBG_VALUE %0(s32), $noreg, !7, !DIExpression(), debug-location !9
|
2017-03-20 00:12:53 +08:00
|
|
|
...
|