
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
57 lines
2.5 KiB
LLVM
57 lines
2.5 KiB
LLVM
; RUN: opt -passes=early-cse -earlycse-debug-hash -S %s -o - | FileCheck %s
|
|
|
|
; PR40628: The first load below is determined to be redundant by EarlyCSE.
|
|
; During salvaging, the corresponding dbg.value could have a DW_OP_deref used
|
|
; in its DIExpression to represent the redundant operation -- however LLVM
|
|
; cannot currently determine that the subsequent store should terminate the
|
|
; variables location range. A debugger would display zero for the "redundant"
|
|
; variable after stepping onto the return instruction.
|
|
|
|
; Test that the load being removed results in the corresponding dbg.value
|
|
; being assigned the 'undef' value.
|
|
|
|
; CHECK: @foo
|
|
; CHECK-NEXT: #dbg_value(i32 poison, ![[DEADVAR:[0-9]+]],
|
|
; CHECK-NEXT: load
|
|
; CHECK-NEXT: #dbg_value(i32 %{{[0-9]+}}, ![[LIVEVAR:[0-9]+]],
|
|
; CHECK-NEXT: store
|
|
; CHECK-NEXT: ret
|
|
|
|
; CHECK: ![[DEADVAR]] = !DILocalVariable(name: "redundant",
|
|
; CHECK: ![[LIVEVAR]] = !DILocalVariable(name: "loaded",
|
|
|
|
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
|
|
target triple = "x86_64-unknown-linux-gnu"
|
|
|
|
define dso_local i32 @foo(ptr) !dbg !7 {
|
|
%2 = load i32, ptr %0, align 4, !dbg !23
|
|
call void @llvm.dbg.value(metadata i32 %2, metadata !16, metadata !DIExpression()), !dbg !23
|
|
%3 = load i32, ptr %0, align 4, !dbg !23
|
|
call void @llvm.dbg.value(metadata i32 %3, metadata !17, metadata !DIExpression()), !dbg !23
|
|
store i32 0, ptr %0, align 4, !dbg !23
|
|
ret i32 %3, !dbg !23
|
|
}
|
|
|
|
declare void @llvm.dbg.value(metadata, metadata, metadata)
|
|
|
|
!llvm.dbg.cu = !{!0}
|
|
!llvm.module.flags = !{!3, !4, !5}
|
|
!llvm.ident = !{!6}
|
|
|
|
!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, nameTableKind: None)
|
|
!1 = !DIFile(filename: "pr40628.c", directory: ".")
|
|
!2 = !{}
|
|
!3 = !{i32 2, !"Dwarf Version", i32 4}
|
|
!4 = !{i32 2, !"Debug Info Version", i32 3}
|
|
!5 = !{i32 1, !"wchar_size", i32 4}
|
|
!6 = !{!"clang"}
|
|
!7 = distinct !DISubprogram(name: "foo", scope: !1, file: !1, line: 2, type: !8, scopeLine: 3, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !12)
|
|
!8 = !DISubroutineType(types: !9)
|
|
!9 = !{!10, !11}
|
|
!10 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
|
|
!11 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !10, size: 64)
|
|
!12 = !{!16, !17}
|
|
!16 = !DILocalVariable(name: "redundant", scope: !7, file: !1, line: 4, type: !10)
|
|
!17 = !DILocalVariable(name: "loaded", scope: !7, file: !1, line: 5, type: !10)
|
|
!23 = !DILocation(line: 4, column: 7, scope: !7)
|