Files
clang-p2996/llvm/test/CodeGen/Generic/MIRStripDebug/dont-strip-real-debug-info.mir
Stephen Tozer 094572701d [RemoveDIs] Print IR with debug records by default (#91724)
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
2024-06-14 15:07:27 +01:00

87 lines
4.2 KiB
YAML

# RUN: llc -run-pass=mir-strip-debug -o - %s | FileCheck %s
# RUN: llc -run-pass=mir-strip-debug,mir-debugify,mir-strip-debug -o - %s | FileCheck %s
--- |
; ModuleID = 'loc-only.ll'
source_filename = "loc-only.ll"
define i32 @test(i32 %a, i32 %b) !dbg !4 {
%add = add i32 %a, 2, !dbg !10
call void @llvm.dbg.value(metadata i32 %add, metadata !7, metadata !DIExpression()), !dbg !10
%sub = sub i32 %add, %b, !dbg !11
call void @llvm.dbg.value(metadata i32 %sub, metadata !9, metadata !DIExpression()), !dbg !11
ret i32 %sub, !dbg !12
}
; CHECK-LABEL: define i32 @test(i32 %a, i32 %b) {{(addrspace\([0-9]+\) )?}}!dbg !4 {
; CHECK-NEXT: %add = add i32 %a, 2, !dbg !10
; CHECK-NEXT: #dbg_value(i32 %add, !7, !DIExpression(), !10
; CHECK-NEXT: %sub = sub i32 %add, %b, !dbg !11
; CHECK-NEXT: #dbg_value(i32 %sub, !9, !DIExpression(), !11
; CHECK-NEXT: ret i32 %sub, !dbg !12
; CHECK-NEXT: }
; Function Attrs: nounwind readnone speculatable willreturn
declare void @llvm.dbg.value(metadata, metadata, metadata) #0
; Function Attrs: nounwind
declare void @llvm.stackprotector(ptr, ptr) #1
attributes #0 = { nounwind readnone speculatable willreturn }
attributes #1 = { nounwind }
!llvm.dbg.cu = !{!0}
; CHECK: !llvm.dbg.cu = !{!0}
!llvm.module.flags = !{!3}
; CHECK: !llvm.module.flags = !{!3}
!0 = distinct !DICompileUnit(language: DW_LANG_C, file: !1, producer: "debugify", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2)
!1 = !DIFile(filename: "<stdin>", directory: "/")
!2 = !{}
!3 = !{i32 2, !"Debug Info Version", i32 3}
!4 = distinct !DISubprogram(name: "test", linkageName: "test", scope: null, file: !1, line: 1, type: !5, scopeLine: 1, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !6)
!5 = !DISubroutineType(types: !2)
!6 = !{!7, !9}
!7 = !DILocalVariable(name: "1", scope: !4, file: !1, line: 1, type: !8)
!8 = !DIBasicType(name: "ty32", size: 32, encoding: DW_ATE_unsigned)
!9 = !DILocalVariable(name: "2", scope: !4, file: !1, line: 2, type: !8)
!10 = !DILocation(line: 1, column: 1, scope: !4)
!11 = !DILocation(line: 2, column: 1, scope: !4)
!12 = !DILocation(line: 3, column: 1, scope: !4)
; CHECK: !0 = distinct !DICompileUnit(language: DW_LANG_C, file: !1, producer: "debugify", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2)
; CHECK: !1 = !DIFile(filename: "<stdin>", directory: "/")
; CHECK: !2 = !{}
; CHECK: !3 = !{i32 2, !"Debug Info Version", i32 3}
; CHECK: !4 = distinct !DISubprogram(name: "test", linkageName: "test", scope: null, file: !1, line: 1, type: !5, scopeLine: 1, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !6)
; CHECK: !5 = !DISubroutineType(types: !2)
; CHECK: !6 = !{!7, !9}
; CHECK: !7 = !DILocalVariable(name: "1", scope: !4, file: !1, line: 1, type: !8)
; CHECK: !8 = !DIBasicType(name: "ty32", size: 32, encoding: DW_ATE_unsigned)
; CHECK: !9 = !DILocalVariable(name: "2", scope: !4, file: !1, line: 2, type: !8)
; CHECK: !10 = !DILocation(line: 1, column: 1, scope: !4)
; CHECK: !11 = !DILocation(line: 2, column: 1, scope: !4)
; CHECK: !12 = !DILocation(line: 3, column: 1, scope: !4)
...
---
name: test
body: |
bb.1 (%ir-block.0):
%0:_(s32) = G_IMPLICIT_DEF
%1:_(s32) = G_IMPLICIT_DEF
%2:_(s32) = G_CONSTANT i32 2, debug-location !DILocation(line: 0, scope: !4)
%3:_(s32) = G_ADD %0, %2, debug-location !10
DBG_VALUE %3(s32), $noreg, !7, !DIExpression(), debug-location !10
%4:_(s32) = G_SUB %3, %1, debug-location !11
DBG_VALUE %4(s32), $noreg, !9, !DIExpression(), debug-location !11
; CHECK-LABEL: body:
; CHECK-NEXT: bb
; CHECK-NEXT: %0:_(s32) = G_IMPLICIT_DEF{{$}}
; CHECK-NEXT: %1:_(s32) = G_IMPLICIT_DEF{{$}}
; CHECK-NEXT: %2:_(s32) = G_CONSTANT i32 2, debug-location !DILocation(line: 0, scope: !4)
; CHECK-NEXT: %3:_(s32) = G_ADD %0, %2, debug-location !10
; CHECK-NEXT: DBG_VALUE %3(s32), $noreg, !7, !DIExpression(), debug-location !10
; CHECK-NEXT: %4:_(s32) = G_SUB %3, %1, debug-location !11
; CHECK-NEXT: DBG_VALUE %4(s32), $noreg, !9, !DIExpression(), debug-location !11
...