
By chance, two things have prevented the autoupgrade path being exercised much so far: * LLParser setting the debug-info mode to "old" on seeing intrinsics, * The test in AutoUpgrade.cpp wanting to upgrade into a "new" debug-info block. In practice, this appears to mean this code path hasn't seen the various invalid inputs that can come its way. This commit does a number of things: * Tolerates the various illegal inputs that can be written with debug-intrinsics, and that must be tolerated until the Verifier runs, * Printing illegal/null DbgRecord fields must succeed, * Verifier errors need to localise the function/block where the error is, * Tests that now see debug records will print debug-record errors, Plus a few new tests for other intrinsic-to-debug-record failures modes I found. There are also two edge cases: * Some of the unit tests switch back and forth between intrinsic and record modes at will; I've deleted coverage and some assertions to tolerate this as intrinsic support is now Gone (TM), * In sroa-extract-bits.ll, the order of debug records flips. This is because the autoupgrader upgrades in the opposite order to the basic block conversion routines... which doesn't change the record order, but _does_ change the use list order in Metadata! This should (TM) have no consequence to the correctness of LLVM, but will change the order of various records and the order of DWARF record output too. I tried to reduce this patch to a smaller collection of changes, but they're all intertwined, sorry.
47 lines
1.9 KiB
LLVM
47 lines
1.9 KiB
LLVM
; RUN: llvm-as %s -o - 2>&1 | FileCheck %s
|
|
; CHECK: invalid #dbg record expression
|
|
;
|
|
; Fossilised debug-info with only two arguments to dbg.declare have been
|
|
; spotted in LLVMs test suite (debug-info-always-inline.ll), test that this
|
|
; does not cause a crash. LLVM needs to be able to autoupgrade invalid
|
|
; dbg.declares to invalid #dbg_declares because this occurs before the
|
|
; Verifier runs.
|
|
|
|
; ModuleID = 'out.ll'
|
|
source_filename = "llvm/test/DebugInfo/Generic/debug-info-always-inline.ll"
|
|
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
|
|
target triple = "x86_64-unknown-linux-gnu"
|
|
|
|
declare void @llvm.dbg.declare(metadata, metadata, metadata)
|
|
|
|
; Function Attrs: alwaysinline nounwind sspstrong
|
|
define i32 @_Z3foov() !dbg !7 {
|
|
entry:
|
|
%sum = alloca i32, align 4, !dbg !11
|
|
call void @llvm.dbg.declare(metadata ptr %sum, metadata !26), !dbg !11
|
|
ret i32 0, !dbg !15
|
|
}
|
|
|
|
declare void @_Z3barv()
|
|
|
|
!llvm.module.flags = !{!0, !1}
|
|
!llvm.ident = !{!2}
|
|
!llvm.dbg.cu = !{!3}
|
|
!llvm.debugify = !{!5, !6}
|
|
|
|
!0 = !{i32 2, !"Dwarf Version", i32 4}
|
|
!1 = !{i32 2, !"Debug Info Version", i32 3}
|
|
!2 = !{!"clang version 3.6.0 (217844)"}
|
|
!3 = distinct !DICompileUnit(language: DW_LANG_C, file: !4, producer: "debugify", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug)
|
|
!4 = !DIFile(filename: "/fast/fs/llvm-main/llvm/test/DebugInfo/Generic/debug-info-always-inline.ll", directory: "/")
|
|
!5 = !{i32 14}
|
|
!6 = !{i32 7}
|
|
!7 = distinct !DISubprogram(name: "_Z3foov", linkageName: "_Z3foov", scope: null, file: !4, line: 1, type: !8, scopeLine: 1, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !3, retainedNodes: !9)
|
|
!8 = !DISubroutineType(types: !9)
|
|
!9 = !{}
|
|
!11 = !DILocation(line: 2, column: 1, scope: !7)
|
|
!15 = !DILocation(line: 6, column: 1, scope: !7)
|
|
!25 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
|
|
!26 = !DILocalVariable(name: "b", scope: !7, file: !4, line: 1234, type: !25)
|
|
|