This patch makes the final major change of the RemoveDIs project, changing the default IR output from debug intrinsics to debug records. This is expected to break a large number of tests: every single one that tests for uses or declarations of debug intrinsics and does not explicitly disable writing records. If this patch has broken your downstream tests (or upstream tests on a configuration I wasn't able to run): 1. If you need to immediately unblock a build, pass `--write-experimental-debuginfo=false` to LLVM's option processing for all failing tests (remember to use `-mllvm` for clang/flang to forward arguments to LLVM). 2. For most test failures, the changes are trivial and mechanical, enough that they can be done by script; see the migration guide for a guide on how to do this: https://llvm.org/docs/RemoveDIsDebugInfo.html#test-updates 3. If any tests fail for reasons other than FileCheck check lines that need updating, such as assertion failures, that is most likely a real bug with this patch and should be reported as such. For more information, see the recent PSA: https://discourse.llvm.org/t/psa-ir-output-changing-from-debug-intrinsics-to-debug-records/79578
99 lines
3.8 KiB
LLVM
99 lines
3.8 KiB
LLVM
; RUN: opt < %s -S -passes=inline | FileCheck %s
|
|
; RUN: opt < %s -S -passes='cgscc(inline)' | FileCheck %s
|
|
;
|
|
; The purpose of this test is to check that inline pass preserves debug info
|
|
; for variable using the dbg.declare intrinsic.
|
|
;
|
|
;; This test was generated by running this command:
|
|
;; clang.exe -S -O0 -emit-llvm -g foo.c
|
|
;;
|
|
;; foo.c
|
|
;; ==========================
|
|
;; float foo(float x)
|
|
;; {
|
|
;; return x;
|
|
;; }
|
|
;;
|
|
;; void bar(ptr dst)
|
|
;; {
|
|
;; dst[0] = foo(dst[0]);
|
|
;; }
|
|
;; ==========================
|
|
|
|
target datalayout = "e-m:w-p:32:32-i64:64-f80:32-n8:16:32-S32"
|
|
target triple = "i686-pc-windows-msvc"
|
|
|
|
; Function Attrs: nounwind
|
|
define float @foo(float %x) #0 !dbg !4 {
|
|
entry:
|
|
%x.addr = alloca float, align 4
|
|
store float %x, ptr %x.addr, align 4
|
|
call void @llvm.dbg.declare(metadata ptr %x.addr, metadata !16, metadata !17), !dbg !18
|
|
%0 = load float, ptr %x.addr, align 4, !dbg !19
|
|
ret float %0, !dbg !19
|
|
}
|
|
|
|
; Function Attrs: nounwind readnone
|
|
declare void @llvm.dbg.declare(metadata, metadata, metadata) #1
|
|
|
|
; CHECK: define void @bar
|
|
|
|
; Function Attrs: nounwind
|
|
define void @bar(ptr %dst) #0 !dbg !9 {
|
|
entry:
|
|
|
|
; CHECK: [[x_addr_i:%.+]] = alloca float, align 4
|
|
; CHECK: store float {{.*}}, ptr [[x_addr_i]]
|
|
; CHECK-NEXT: #dbg_declare(ptr [[x_addr_i]], [[m23:![0-9]+]], !DIExpression(), [[m24:![0-9]+]]
|
|
|
|
%dst.addr = alloca ptr, align 4
|
|
store ptr %dst, ptr %dst.addr, align 4
|
|
call void @llvm.dbg.declare(metadata ptr %dst.addr, metadata !20, metadata !17), !dbg !21
|
|
%0 = load ptr, ptr %dst.addr, align 4, !dbg !22
|
|
%1 = load float, ptr %0, align 4, !dbg !22
|
|
%call = call float @foo(float %1), !dbg !22
|
|
|
|
; CHECK-NOT: call float @foo
|
|
|
|
%2 = load ptr, ptr %dst.addr, align 4, !dbg !22
|
|
store float %call, ptr %2, align 4, !dbg !22
|
|
ret void, !dbg !23
|
|
}
|
|
|
|
attributes #0 = { nounwind }
|
|
attributes #1 = { nounwind readnone }
|
|
|
|
!llvm.dbg.cu = !{!0}
|
|
!llvm.module.flags = !{!13, !14}
|
|
!llvm.ident = !{!15}
|
|
|
|
!0 = distinct !DICompileUnit(language: DW_LANG_C99, producer: "clang version 3.6.0 (trunk)", isOptimized: false, emissionKind: FullDebug, file: !1, enums: !2, retainedTypes: !2, globals: !2, imports: !2)
|
|
!1 = !DIFile(filename: "foo.c", directory: "")
|
|
!2 = !{}
|
|
!4 = distinct !DISubprogram(name: "foo", line: 1, isLocal: false, isDefinition: true, flags: DIFlagPrototyped, isOptimized: false, unit: !0, scopeLine: 2, file: !1, scope: !5, type: !6, retainedNodes: !2)
|
|
!5 = !DIFile(filename: "foo.c", directory: "")
|
|
!6 = !DISubroutineType(types: !7)
|
|
!7 = !{!8, !8}
|
|
!8 = !DIBasicType(tag: DW_TAG_base_type, name: "float", size: 32, align: 32, encoding: DW_ATE_float)
|
|
!9 = distinct !DISubprogram(name: "bar", line: 6, isLocal: false, isDefinition: true, flags: DIFlagPrototyped, isOptimized: false, unit: !0, scopeLine: 7, file: !1, scope: !5, type: !10, retainedNodes: !2)
|
|
!10 = !DISubroutineType(types: !11)
|
|
!11 = !{null, !12}
|
|
!12 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 32, align: 32, baseType: !8)
|
|
!13 = !{i32 2, !"Dwarf Version", i32 4}
|
|
!14 = !{i32 2, !"Debug Info Version", i32 3}
|
|
!15 = !{!"clang version 3.6.0 (trunk)"}
|
|
!16 = !DILocalVariable(name: "x", line: 1, arg: 1, scope: !4, file: !5, type: !8)
|
|
!17 = !DIExpression()
|
|
!18 = !DILocation(line: 1, column: 17, scope: !4)
|
|
!19 = !DILocation(line: 3, column: 5, scope: !4)
|
|
!20 = !DILocalVariable(name: "dst", line: 6, arg: 1, scope: !9, file: !5, type: !12)
|
|
!21 = !DILocation(line: 6, column: 17, scope: !9)
|
|
!22 = !DILocation(line: 8, column: 14, scope: !9)
|
|
!23 = !DILocation(line: 9, column: 1, scope: !9)
|
|
|
|
; CHECK: [[FOO:![0-9]+]] = distinct !DISubprogram(name: "foo",
|
|
; CHECK: [[m23]] = !DILocalVariable(name: "x", arg: 1, scope: [[FOO]]
|
|
; CHECK: [[BAR:![0-9]+]] = distinct !DISubprogram(name: "bar",
|
|
; CHECK: [[m24]] = !DILocation(line: 1, column: 17, scope: [[FOO]], inlinedAt: [[CALL_SITE:![0-9]+]])
|
|
; CHECK: [[CALL_SITE]] = distinct !DILocation(line: 8, column: 14, scope: [[BAR]])
|