mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-22 18:54:02 +01:00
[Instruction] Set metadata uses to undef on deletion
Summary: Replace any extant metadata uses of a dying instruction with undef to preserve debug info accuracy. Some alternatives include: - Treat Instruction like any other Value, and point its extant metadata uses to an empty ValueAsMetadata node. This makes extant dbg.value uses trivially dead (i.e. fair game for deletion in many passes), leading to stale dbg.values being in effect for too long. - Call salvageDebugInfoOrMarkUndef. Not needed to make instruction removal correct. OTOH results in wasted work in some common cases (e.g. when all instructions in a BasicBlock are deleted). This came up while discussing some basic cases in https://reviews.llvm.org/D80052. Reviewers: jmorse, TWeaver, aprantl, dexonsmith, jdoerfert Subscribers: jholewinski, qcolombet, hiraditya, jfb, sstefan1, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D80264
This commit is contained in:
parent
073a1e428c
commit
fa1b88c3f1
@ -43,6 +43,19 @@ Instruction::Instruction(Type *ty, unsigned it, Use *Ops, unsigned NumOps,
|
||||
|
||||
Instruction::~Instruction() {
|
||||
assert(!Parent && "Instruction still linked in the program!");
|
||||
|
||||
// Replace any extant metadata uses of this instruction with undef to
|
||||
// preserve debug info accuracy. Some alternatives include:
|
||||
// - Treat Instruction like any other Value, and point its extant metadata
|
||||
// uses to an empty ValueAsMetadata node. This makes extant dbg.value uses
|
||||
// trivially dead (i.e. fair game for deletion in many passes), leading to
|
||||
// stale dbg.values being in effect for too long.
|
||||
// - Call salvageDebugInfoOrMarkUndef. Not needed to make instruction removal
|
||||
// correct. OTOH results in wasted work in some common cases (e.g. when all
|
||||
// instructions in a BasicBlock are deleted).
|
||||
if (isUsedByMetadata())
|
||||
ValueAsMetadata::handleRAUW(this, UndefValue::get(getType()));
|
||||
|
||||
if (hasMetadataHashEntry())
|
||||
clearMetadataHashEntries();
|
||||
}
|
||||
|
@ -82,255 +82,275 @@ declare void @llvm.dbg.declare(metadata, metadata, metadata)
|
||||
!38 = !DILocation(line: 9, column: 10, scope: !17)
|
||||
!39 = !DILocation(line: 10, column: 1, scope: !17)
|
||||
|
||||
; CHECK: .section .debug_abbrev
|
||||
; CHECK-NEXT: {
|
||||
; CHECK-NEXT: .b8 1 // Abbreviation Code
|
||||
; CHECK-NEXT: .b8 17 // DW_TAG_compile_unit
|
||||
; CHECK-NEXT: .b8 1 // DW_CHILDREN_yes
|
||||
; CHECK-NEXT: .b8 37 // DW_AT_producer
|
||||
; CHECK-NEXT: .b8 8 // DW_FORM_string
|
||||
; CHECK-NEXT: .b8 19 // DW_AT_language
|
||||
; CHECK-NEXT: .b8 5 // DW_FORM_data2
|
||||
; CHECK-NEXT: .b8 3 // DW_AT_name
|
||||
; CHECK-NEXT: .b8 8 // DW_FORM_string
|
||||
; CHECK-NEXT: .b8 16 // DW_AT_stmt_list
|
||||
; CHECK-NEXT: .b8 6 // DW_FORM_data4
|
||||
; CHECK-NEXT: .b8 27 // DW_AT_comp_dir
|
||||
; CHECK-NEXT: .b8 8 // DW_FORM_string
|
||||
; CHECK-NEXT: .b8 17 // DW_AT_low_pc
|
||||
; CHECK-NEXT: .b8 1 // DW_FORM_addr
|
||||
; CHECK-NEXT: .b8 18 // DW_AT_high_pc
|
||||
; CHECK-NEXT: .b8 1 // DW_FORM_addr
|
||||
; CHECK-NEXT: .b8 0 // EOM(1)
|
||||
; CHECK-NEXT: .b8 0 // EOM(2)
|
||||
; CHECK-NEXT: .b8 2 // Abbreviation Code
|
||||
; CHECK-NEXT: .b8 52 // DW_TAG_variable
|
||||
; CHECK-NEXT: .b8 0 // DW_CHILDREN_no
|
||||
; CHECK-NEXT: .b8 3 // DW_AT_name
|
||||
; CHECK-NEXT: .b8 8 // DW_FORM_string
|
||||
; CHECK-NEXT: .b8 73 // DW_AT_type
|
||||
; CHECK-NEXT: .b8 19 // DW_FORM_ref4
|
||||
; CHECK-NEXT: .b8 63 // DW_AT_external
|
||||
; CHECK-NEXT: .b8 12 // DW_FORM_flag
|
||||
; CHECK-NEXT: .b8 58 // DW_AT_decl_file
|
||||
; CHECK-NEXT: .b8 11 // DW_FORM_data1
|
||||
; CHECK-NEXT: .b8 59 // DW_AT_decl_line
|
||||
; CHECK-NEXT: .b8 11 // DW_FORM_data1
|
||||
; CHECK-NEXT: .b8 51 // DW_AT_address_class
|
||||
; CHECK-NEXT: .b8 11 // DW_FORM_data1
|
||||
; CHECK-NEXT: .b8 2 // DW_AT_location
|
||||
; CHECK-NEXT: .b8 10 // DW_FORM_block1
|
||||
; CHECK-NEXT: .b8 0 // EOM(1)
|
||||
; CHECK-NEXT: .b8 0 // EOM(2)
|
||||
; CHECK-NEXT: .b8 3 // Abbreviation Code
|
||||
; CHECK-NEXT: .b8 36 // DW_TAG_base_type
|
||||
; CHECK-NEXT: .b8 0 // DW_CHILDREN_no
|
||||
; CHECK-NEXT: .b8 3 // DW_AT_name
|
||||
; CHECK-NEXT: .b8 8 // DW_FORM_string
|
||||
; CHECK-NEXT: .b8 62 // DW_AT_encoding
|
||||
; CHECK-NEXT: .b8 11 // DW_FORM_data1
|
||||
; CHECK-NEXT: .b8 11 // DW_AT_byte_size
|
||||
; CHECK-NEXT: .b8 11 // DW_FORM_data1
|
||||
; CHECK-NEXT: .b8 0 // EOM(1)
|
||||
; CHECK-NEXT: .b8 0 // EOM(2)
|
||||
; CHECK-NEXT: .b8 4 // Abbreviation Code
|
||||
; CHECK-NEXT: .b8 46 // DW_TAG_subprogram
|
||||
; CHECK-NEXT: .b8 1 // DW_CHILDREN_yes
|
||||
; CHECK-NEXT: .b8 17 // DW_AT_low_pc
|
||||
; CHECK-NEXT: .b8 1 // DW_FORM_addr
|
||||
; CHECK-NEXT: .b8 18 // DW_AT_high_pc
|
||||
; CHECK-NEXT: .b8 1 // DW_FORM_addr
|
||||
; CHECK-NEXT: .b8 64 // DW_AT_frame_base
|
||||
; CHECK-NEXT: .b8 10 // DW_FORM_block1
|
||||
; CHECK-NEXT: .b8 135 // DW_AT_MIPS_linkage_name
|
||||
; CHECK-NEXT: .b8 64
|
||||
; CHECK-NEXT: .b8 8 // DW_FORM_string
|
||||
; CHECK-NEXT: .b8 3 // DW_AT_name
|
||||
; CHECK-NEXT: .b8 8 // DW_FORM_string
|
||||
; CHECK-NEXT: .b8 58 // DW_AT_decl_file
|
||||
; CHECK-NEXT: .b8 11 // DW_FORM_data1
|
||||
; CHECK-NEXT: .b8 59 // DW_AT_decl_line
|
||||
; CHECK-NEXT: .b8 11 // DW_FORM_data1
|
||||
; CHECK-NEXT: .b8 63 // DW_AT_external
|
||||
; CHECK-NEXT: .b8 12 // DW_FORM_flag
|
||||
; CHECK-NEXT: .b8 0 // EOM(1)
|
||||
; CHECK-NEXT: .b8 0 // EOM(2)
|
||||
; CHECK-NEXT: .b8 5 // Abbreviation Code
|
||||
; CHECK-NEXT: .b8 5 // DW_TAG_formal_parameter
|
||||
; CHECK-NEXT: .b8 0 // DW_CHILDREN_no
|
||||
; CHECK-NEXT: .b8 3 // DW_AT_name
|
||||
; CHECK-NEXT: .b8 8 // DW_FORM_string
|
||||
; CHECK-NEXT: .b8 58 // DW_AT_decl_file
|
||||
; CHECK-NEXT: .b8 11 // DW_FORM_data1
|
||||
; CHECK-NEXT: .b8 59 // DW_AT_decl_line
|
||||
; CHECK-NEXT: .b8 11 // DW_FORM_data1
|
||||
; CHECK-NEXT: .b8 73 // DW_AT_type
|
||||
; CHECK-NEXT: .b8 19 // DW_FORM_ref4
|
||||
; CHECK-NEXT: .b8 0 // EOM(1)
|
||||
; CHECK-NEXT: .b8 0 // EOM(2)
|
||||
; CHECK-NEXT: .b8 0 // EOM(3)
|
||||
; CHECK-NEXT: }
|
||||
; CHECK-NEXT: .section .debug_info
|
||||
; CHECK-NEXT: {
|
||||
; CHECK-NEXT: .b32 217 // Length of Unit
|
||||
; CHECK-NEXT: .b8 2 // DWARF version number
|
||||
; CHECK-NEXT: .b8 0
|
||||
; CHECK-NEXT: .b32 .debug_abbrev // Offset Into Abbrev. Section
|
||||
; CHECK-NEXT: .b8 8 // Address Size (in bytes)
|
||||
; CHECK-NEXT: .b8 1 // Abbrev [1] 0xb:0xd2 DW_TAG_compile_unit
|
||||
; CHECK-NEXT: .b8 99 // DW_AT_producer
|
||||
; CHECK-NEXT: .b8 108
|
||||
; CHECK-NEXT: .b8 97
|
||||
; CHECK-NEXT: .b8 110
|
||||
; CHECK-NEXT: .b8 103
|
||||
; CHECK-NEXT: .b8 32
|
||||
; CHECK-NEXT: .b8 118
|
||||
; CHECK-NEXT: .b8 101
|
||||
; CHECK-NEXT: .b8 114
|
||||
; CHECK-NEXT: .b8 115
|
||||
; CHECK-NEXT: .b8 105
|
||||
; CHECK-NEXT: .b8 111
|
||||
; CHECK-NEXT: .b8 110
|
||||
; CHECK-NEXT: .b8 32
|
||||
; CHECK-NEXT: .b8 57
|
||||
; CHECK-NEXT: .b8 46
|
||||
; CHECK-NEXT: .b8 48
|
||||
; CHECK-NEXT: .b8 46
|
||||
; CHECK-NEXT: .b8 48
|
||||
; CHECK-NEXT: .b8 32
|
||||
; CHECK-NEXT: .b8 40
|
||||
; CHECK-NEXT: .b8 116
|
||||
; CHECK-NEXT: .b8 114
|
||||
; CHECK-NEXT: .b8 117
|
||||
; CHECK-NEXT: .b8 110
|
||||
; CHECK-NEXT: .b8 107
|
||||
; CHECK-NEXT: .b8 32
|
||||
; CHECK-NEXT: .b8 51
|
||||
; CHECK-NEXT: .b8 53
|
||||
; CHECK-NEXT: .b8 49
|
||||
; CHECK-NEXT: .b8 57
|
||||
; CHECK-NEXT: .b8 54
|
||||
; CHECK-NEXT: .b8 57
|
||||
; CHECK-NEXT: .b8 41
|
||||
; CHECK-NEXT: .b8 32
|
||||
; CHECK-NEXT: .b8 40
|
||||
; CHECK-NEXT: .b8 108
|
||||
; CHECK-NEXT: .b8 108
|
||||
; CHECK-NEXT: .b8 118
|
||||
; CHECK-NEXT: .b8 109
|
||||
; CHECK-NEXT: .b8 47
|
||||
; CHECK-NEXT: .b8 116
|
||||
; CHECK-NEXT: .b8 114
|
||||
; CHECK-NEXT: .b8 117
|
||||
; CHECK-NEXT: .b8 110
|
||||
; CHECK-NEXT: .b8 107
|
||||
; CHECK-NEXT: .b8 32
|
||||
; CHECK-NEXT: .b8 51
|
||||
; CHECK-NEXT: .b8 53
|
||||
; CHECK-NEXT: .b8 49
|
||||
; CHECK-NEXT: .b8 57
|
||||
; CHECK-NEXT: .b8 55
|
||||
; CHECK-NEXT: .b8 51
|
||||
; CHECK-NEXT: .b8 41
|
||||
; CHECK-NEXT: .b8 0
|
||||
; CHECK-NEXT: .b8 4 // DW_AT_language
|
||||
; CHECK-NEXT: .b8 0
|
||||
; CHECK-NEXT: .b8 110 // DW_AT_name
|
||||
; CHECK-NEXT: .b8 101
|
||||
; CHECK-NEXT: .b8 119
|
||||
; CHECK-NEXT: .b8 46
|
||||
; CHECK-NEXT: .b8 99
|
||||
; CHECK-NEXT: .b8 99
|
||||
; CHECK-NEXT: .b8 0
|
||||
; CHECK-NEXT: .b32 .debug_line // DW_AT_stmt_list
|
||||
; CHECK-NEXT: .b8 47 // DW_AT_comp_dir
|
||||
; CHECK-NEXT: .b8 116
|
||||
; CHECK-NEXT: .b8 109
|
||||
; CHECK-NEXT: .b8 112
|
||||
; CHECK-NEXT: .b8 0
|
||||
; CHECK-NEXT: .b64 Lfunc_begin0 // DW_AT_low_pc
|
||||
; CHECK-NEXT: .b64 Lfunc_end0 // DW_AT_high_pc
|
||||
; CHECK-NEXT: .b8 2 // Abbrev [2] 0x65:0x1a DW_TAG_variable
|
||||
; CHECK-NEXT: .b8 71 // DW_AT_name
|
||||
; CHECK-NEXT: .b8 76
|
||||
; CHECK-NEXT: .b8 79
|
||||
; CHECK-NEXT: .b8 66
|
||||
; CHECK-NEXT: .b8 65
|
||||
; CHECK-NEXT: .b8 76
|
||||
; CHECK-NEXT: .b8 0
|
||||
; CHECK-NEXT: .b32 127 // DW_AT_type
|
||||
; CHECK-NEXT: .b8 1 // DW_AT_external
|
||||
; CHECK-NEXT: .b8 1 // DW_AT_decl_file
|
||||
; CHECK-NEXT: .b8 3 // DW_AT_decl_line
|
||||
; CHECK-NEXT: .b8 5 // DW_AT_address_class
|
||||
; CHECK-NEXT: .b8 9 // DW_AT_location
|
||||
; CHECK-NEXT: .b8 3
|
||||
; CHECK-NEXT: .b64 GLOBAL
|
||||
; CHECK-NEXT: .b8 3 // Abbrev [3] 0x7f:0x7 DW_TAG_base_type
|
||||
; CHECK-NEXT: .b8 105 // DW_AT_name
|
||||
; CHECK-NEXT: .b8 110
|
||||
; CHECK-NEXT: .b8 116
|
||||
; CHECK-NEXT: .b8 0
|
||||
; CHECK-NEXT: .b8 5 // DW_AT_encoding
|
||||
; CHECK-NEXT: .b8 4 // DW_AT_byte_size
|
||||
; CHECK-NEXT: .b8 2 // Abbrev [2] 0x86:0x1a DW_TAG_variable
|
||||
; CHECK-NEXT: .b8 83 // DW_AT_name
|
||||
; CHECK-NEXT: .b8 72
|
||||
; CHECK-NEXT: .b8 65
|
||||
; CHECK-NEXT: .b8 82
|
||||
; CHECK-NEXT: .b8 69
|
||||
; CHECK-NEXT: .b8 68
|
||||
; CHECK-NEXT: .b8 0
|
||||
; CHECK-NEXT: .b32 127 // DW_AT_type
|
||||
; CHECK-NEXT: .b8 1 // DW_AT_external
|
||||
; CHECK-NEXT: .b8 1 // DW_AT_decl_file
|
||||
; CHECK-NEXT: .b8 4 // DW_AT_decl_line
|
||||
; CHECK-NEXT: .b8 8 // DW_AT_address_class
|
||||
; CHECK-NEXT: .b8 9 // DW_AT_location
|
||||
; CHECK-NEXT: .b8 3
|
||||
; CHECK-NEXT: .b64 SHARED
|
||||
; CHECK-NEXT: .b8 4 // Abbrev [4] 0xa0:0x33 DW_TAG_subprogram
|
||||
; CHECK-NEXT: .b64 Lfunc_begin0 // DW_AT_low_pc
|
||||
; CHECK-NEXT: .b64 Lfunc_end0 // DW_AT_high_pc
|
||||
; CHECK-NEXT: .b8 1 // DW_AT_frame_base
|
||||
; CHECK-NEXT: .b8 156
|
||||
; CHECK-NEXT: .b8 116 // DW_AT_MIPS_linkage_name
|
||||
; CHECK-NEXT: .b8 101
|
||||
; CHECK-NEXT: .b8 115
|
||||
; CHECK-NEXT: .b8 116
|
||||
; CHECK-NEXT: .b8 0
|
||||
; CHECK-NEXT: .b8 116 // DW_AT_name
|
||||
; CHECK-NEXT: .b8 101
|
||||
; CHECK-NEXT: .b8 115
|
||||
; CHECK-NEXT: .b8 116
|
||||
; CHECK-NEXT: .b8 0
|
||||
; CHECK-NEXT: .b8 1 // DW_AT_decl_file
|
||||
; CHECK-NEXT: .b8 6 // DW_AT_decl_line
|
||||
; CHECK-NEXT: .b8 1 // DW_AT_external
|
||||
; CHECK-NEXT: .b8 5 // Abbrev [5] 0xc0:0x9 DW_TAG_formal_parameter
|
||||
; CHECK-NEXT: .b8 97 // DW_AT_name
|
||||
; CHECK-NEXT: .b8 0
|
||||
; CHECK-NEXT: .b8 1 // DW_AT_decl_file
|
||||
; CHECK-NEXT: .b8 6 // DW_AT_decl_line
|
||||
; CHECK-NEXT: .b32 211 // DW_AT_type
|
||||
; CHECK-NEXT: .b8 5 // Abbrev [5] 0xc9:0x9 DW_TAG_formal_parameter
|
||||
; CHECK-NEXT: .b8 105 // DW_AT_name
|
||||
; CHECK-NEXT: .b8 0
|
||||
; CHECK-NEXT: .b8 1 // DW_AT_decl_file
|
||||
; CHECK-NEXT: .b8 6 // DW_AT_decl_line
|
||||
; CHECK-NEXT: .b32 127 // DW_AT_type
|
||||
; CHECK-NEXT: .b8 0 // End Of Children Mark
|
||||
; CHECK-NEXT: .b8 3 // Abbrev [3] 0xd3:0x9 DW_TAG_base_type
|
||||
; CHECK-NEXT: .b8 102 // DW_AT_name
|
||||
; CHECK-NEXT: .b8 108
|
||||
; CHECK-NEXT: .b8 111
|
||||
; CHECK-NEXT: .b8 97
|
||||
; CHECK-NEXT: .b8 116
|
||||
; CHECK-NEXT: .b8 0
|
||||
; CHECK-NEXT: .b8 4 // DW_AT_encoding
|
||||
; CHECK-NEXT: .b8 4 // DW_AT_byte_size
|
||||
; CHECK-NEXT: .b8 0 // End Of Children Mark
|
||||
; CHECK-NEXT: }
|
||||
; CHECK-NEXT: .section .debug_loc { }
|
||||
; CHECK: .section .debug_abbrev
|
||||
; CHECK-NEXT: {
|
||||
; CHECK-NEXT:.b8 1 // Abbreviation Code
|
||||
; CHECK-NEXT:.b8 17 // DW_TAG_compile_unit
|
||||
; CHECK-NEXT:.b8 1 // DW_CHILDREN_yes
|
||||
; CHECK-NEXT:.b8 37 // DW_AT_producer
|
||||
; CHECK-NEXT:.b8 8 // DW_FORM_string
|
||||
; CHECK-NEXT:.b8 19 // DW_AT_language
|
||||
; CHECK-NEXT:.b8 5 // DW_FORM_data2
|
||||
; CHECK-NEXT:.b8 3 // DW_AT_name
|
||||
; CHECK-NEXT:.b8 8 // DW_FORM_string
|
||||
; CHECK-NEXT:.b8 16 // DW_AT_stmt_list
|
||||
; CHECK-NEXT:.b8 6 // DW_FORM_data4
|
||||
; CHECK-NEXT:.b8 27 // DW_AT_comp_dir
|
||||
; CHECK-NEXT:.b8 8 // DW_FORM_string
|
||||
; CHECK-NEXT:.b8 17 // DW_AT_low_pc
|
||||
; CHECK-NEXT:.b8 1 // DW_FORM_addr
|
||||
; CHECK-NEXT:.b8 18 // DW_AT_high_pc
|
||||
; CHECK-NEXT:.b8 1 // DW_FORM_addr
|
||||
; CHECK-NEXT:.b8 0 // EOM(1)
|
||||
; CHECK-NEXT:.b8 0 // EOM(2)
|
||||
; CHECK-NEXT:.b8 2 // Abbreviation Code
|
||||
; CHECK-NEXT:.b8 52 // DW_TAG_variable
|
||||
; CHECK-NEXT:.b8 0 // DW_CHILDREN_no
|
||||
; CHECK-NEXT:.b8 3 // DW_AT_name
|
||||
; CHECK-NEXT:.b8 8 // DW_FORM_string
|
||||
; CHECK-NEXT:.b8 73 // DW_AT_type
|
||||
; CHECK-NEXT:.b8 19 // DW_FORM_ref4
|
||||
; CHECK-NEXT:.b8 63 // DW_AT_external
|
||||
; CHECK-NEXT:.b8 12 // DW_FORM_flag
|
||||
; CHECK-NEXT:.b8 58 // DW_AT_decl_file
|
||||
; CHECK-NEXT:.b8 11 // DW_FORM_data1
|
||||
; CHECK-NEXT:.b8 59 // DW_AT_decl_line
|
||||
; CHECK-NEXT:.b8 11 // DW_FORM_data1
|
||||
; CHECK-NEXT:.b8 51 // DW_AT_address_class
|
||||
; CHECK-NEXT:.b8 11 // DW_FORM_data1
|
||||
; CHECK-NEXT:.b8 2 // DW_AT_location
|
||||
; CHECK-NEXT:.b8 10 // DW_FORM_block1
|
||||
; CHECK-NEXT:.b8 0 // EOM(1)
|
||||
; CHECK-NEXT:.b8 0 // EOM(2)
|
||||
; CHECK-NEXT:.b8 3 // Abbreviation Code
|
||||
; CHECK-NEXT:.b8 36 // DW_TAG_base_type
|
||||
; CHECK-NEXT:.b8 0 // DW_CHILDREN_no
|
||||
; CHECK-NEXT:.b8 3 // DW_AT_name
|
||||
; CHECK-NEXT:.b8 8 // DW_FORM_string
|
||||
; CHECK-NEXT:.b8 62 // DW_AT_encoding
|
||||
; CHECK-NEXT:.b8 11 // DW_FORM_data1
|
||||
; CHECK-NEXT:.b8 11 // DW_AT_byte_size
|
||||
; CHECK-NEXT:.b8 11 // DW_FORM_data1
|
||||
; CHECK-NEXT:.b8 0 // EOM(1)
|
||||
; CHECK-NEXT:.b8 0 // EOM(2)
|
||||
; CHECK-NEXT:.b8 4 // Abbreviation Code
|
||||
; CHECK-NEXT:.b8 46 // DW_TAG_subprogram
|
||||
; CHECK-NEXT:.b8 1 // DW_CHILDREN_yes
|
||||
; CHECK-NEXT:.b8 17 // DW_AT_low_pc
|
||||
; CHECK-NEXT:.b8 1 // DW_FORM_addr
|
||||
; CHECK-NEXT:.b8 18 // DW_AT_high_pc
|
||||
; CHECK-NEXT:.b8 1 // DW_FORM_addr
|
||||
; CHECK-NEXT:.b8 64 // DW_AT_frame_base
|
||||
; CHECK-NEXT:.b8 10 // DW_FORM_block1
|
||||
; CHECK-NEXT:.b8 135 // DW_AT_MIPS_linkage_name
|
||||
; CHECK-NEXT:.b8 64
|
||||
; CHECK-NEXT:.b8 8 // DW_FORM_string
|
||||
; CHECK-NEXT:.b8 3 // DW_AT_name
|
||||
; CHECK-NEXT:.b8 8 // DW_FORM_string
|
||||
; CHECK-NEXT:.b8 58 // DW_AT_decl_file
|
||||
; CHECK-NEXT:.b8 11 // DW_FORM_data1
|
||||
; CHECK-NEXT:.b8 59 // DW_AT_decl_line
|
||||
; CHECK-NEXT:.b8 11 // DW_FORM_data1
|
||||
; CHECK-NEXT:.b8 63 // DW_AT_external
|
||||
; CHECK-NEXT:.b8 12 // DW_FORM_flag
|
||||
; CHECK-NEXT:.b8 0 // EOM(1)
|
||||
; CHECK-NEXT:.b8 0 // EOM(2)
|
||||
; CHECK-NEXT:.b8 5 // Abbreviation Code
|
||||
; CHECK-NEXT:.b8 5 // DW_TAG_formal_parameter
|
||||
; CHECK-NEXT:.b8 0 // DW_CHILDREN_no
|
||||
; CHECK-NEXT:.b8 3 // DW_AT_name
|
||||
; CHECK-NEXT:.b8 8 // DW_FORM_string
|
||||
; CHECK-NEXT:.b8 58 // DW_AT_decl_file
|
||||
; CHECK-NEXT:.b8 11 // DW_FORM_data1
|
||||
; CHECK-NEXT:.b8 59 // DW_AT_decl_line
|
||||
; CHECK-NEXT:.b8 11 // DW_FORM_data1
|
||||
; CHECK-NEXT:.b8 73 // DW_AT_type
|
||||
; CHECK-NEXT:.b8 19 // DW_FORM_ref4
|
||||
; CHECK-NEXT:.b8 0 // EOM(1)
|
||||
; CHECK-NEXT:.b8 0 // EOM(2)
|
||||
; CHECK-NEXT:.b8 6 // Abbreviation Code
|
||||
; CHECK-NEXT:.b8 15 // DW_TAG_pointer_type
|
||||
; CHECK-NEXT:.b8 0 // DW_CHILDREN_no
|
||||
; CHECK-NEXT:.b8 73 // DW_AT_type
|
||||
; CHECK-NEXT:.b8 19 // DW_FORM_ref4
|
||||
; CHECK-NEXT:.b8 0 // EOM(1)
|
||||
; CHECK-NEXT:.b8 0 // EOM(2)
|
||||
; CHECK-NEXT:.b8 0 // EOM(3)
|
||||
; CHECK-NEXT: }
|
||||
; CHECK-NEXT: .section .debug_info
|
||||
; CHECK-NEXT: {
|
||||
; CHECK-NEXT:.b32 240 // Length of Unit
|
||||
; CHECK-NEXT:.b8 2 // DWARF version number
|
||||
; CHECK-NEXT:.b8 0
|
||||
; CHECK-NEXT:.b32 .debug_abbrev // Offset Into Abbrev. Section
|
||||
; CHECK-NEXT:.b8 8 // Address Size (in bytes)
|
||||
; CHECK-NEXT:.b8 1 // Abbrev [1] 0xb:0xe9 DW_TAG_compile_unit
|
||||
; CHECK-NEXT:.b8 99 // DW_AT_producer
|
||||
; CHECK-NEXT:.b8 108
|
||||
; CHECK-NEXT:.b8 97
|
||||
; CHECK-NEXT:.b8 110
|
||||
; CHECK-NEXT:.b8 103
|
||||
; CHECK-NEXT:.b8 32
|
||||
; CHECK-NEXT:.b8 118
|
||||
; CHECK-NEXT:.b8 101
|
||||
; CHECK-NEXT:.b8 114
|
||||
; CHECK-NEXT:.b8 115
|
||||
; CHECK-NEXT:.b8 105
|
||||
; CHECK-NEXT:.b8 111
|
||||
; CHECK-NEXT:.b8 110
|
||||
; CHECK-NEXT:.b8 32
|
||||
; CHECK-NEXT:.b8 57
|
||||
; CHECK-NEXT:.b8 46
|
||||
; CHECK-NEXT:.b8 48
|
||||
; CHECK-NEXT:.b8 46
|
||||
; CHECK-NEXT:.b8 48
|
||||
; CHECK-NEXT:.b8 32
|
||||
; CHECK-NEXT:.b8 40
|
||||
; CHECK-NEXT:.b8 116
|
||||
; CHECK-NEXT:.b8 114
|
||||
; CHECK-NEXT:.b8 117
|
||||
; CHECK-NEXT:.b8 110
|
||||
; CHECK-NEXT:.b8 107
|
||||
; CHECK-NEXT:.b8 32
|
||||
; CHECK-NEXT:.b8 51
|
||||
; CHECK-NEXT:.b8 53
|
||||
; CHECK-NEXT:.b8 49
|
||||
; CHECK-NEXT:.b8 57
|
||||
; CHECK-NEXT:.b8 54
|
||||
; CHECK-NEXT:.b8 57
|
||||
; CHECK-NEXT:.b8 41
|
||||
; CHECK-NEXT:.b8 32
|
||||
; CHECK-NEXT:.b8 40
|
||||
; CHECK-NEXT:.b8 108
|
||||
; CHECK-NEXT:.b8 108
|
||||
; CHECK-NEXT:.b8 118
|
||||
; CHECK-NEXT:.b8 109
|
||||
; CHECK-NEXT:.b8 47
|
||||
; CHECK-NEXT:.b8 116
|
||||
; CHECK-NEXT:.b8 114
|
||||
; CHECK-NEXT:.b8 117
|
||||
; CHECK-NEXT:.b8 110
|
||||
; CHECK-NEXT:.b8 107
|
||||
; CHECK-NEXT:.b8 32
|
||||
; CHECK-NEXT:.b8 51
|
||||
; CHECK-NEXT:.b8 53
|
||||
; CHECK-NEXT:.b8 49
|
||||
; CHECK-NEXT:.b8 57
|
||||
; CHECK-NEXT:.b8 55
|
||||
; CHECK-NEXT:.b8 51
|
||||
; CHECK-NEXT:.b8 41
|
||||
; CHECK-NEXT:.b8 0
|
||||
; CHECK-NEXT:.b8 4 // DW_AT_language
|
||||
; CHECK-NEXT:.b8 0
|
||||
; CHECK-NEXT:.b8 110 // DW_AT_name
|
||||
; CHECK-NEXT:.b8 101
|
||||
; CHECK-NEXT:.b8 119
|
||||
; CHECK-NEXT:.b8 46
|
||||
; CHECK-NEXT:.b8 99
|
||||
; CHECK-NEXT:.b8 99
|
||||
; CHECK-NEXT:.b8 0
|
||||
; CHECK-NEXT:.b32 .debug_line // DW_AT_stmt_list
|
||||
; CHECK-NEXT:.b8 47 // DW_AT_comp_dir
|
||||
; CHECK-NEXT:.b8 116
|
||||
; CHECK-NEXT:.b8 109
|
||||
; CHECK-NEXT:.b8 112
|
||||
; CHECK-NEXT:.b8 0
|
||||
; CHECK-NEXT:.b64 Lfunc_begin0 // DW_AT_low_pc
|
||||
; CHECK-NEXT:.b64 Lfunc_end0 // DW_AT_high_pc
|
||||
; CHECK-NEXT:.b8 2 // Abbrev [2] 0x65:0x1a DW_TAG_variable
|
||||
; CHECK-NEXT:.b8 71 // DW_AT_name
|
||||
; CHECK-NEXT:.b8 76
|
||||
; CHECK-NEXT:.b8 79
|
||||
; CHECK-NEXT:.b8 66
|
||||
; CHECK-NEXT:.b8 65
|
||||
; CHECK-NEXT:.b8 76
|
||||
; CHECK-NEXT:.b8 0
|
||||
; CHECK-NEXT:.b32 127 // DW_AT_type
|
||||
; CHECK-NEXT:.b8 1 // DW_AT_external
|
||||
; CHECK-NEXT:.b8 1 // DW_AT_decl_file
|
||||
; CHECK-NEXT:.b8 3 // DW_AT_decl_line
|
||||
; CHECK-NEXT:.b8 5 // DW_AT_address_class
|
||||
; CHECK-NEXT:.b8 9 // DW_AT_location
|
||||
; CHECK-NEXT:.b8 3
|
||||
; CHECK-NEXT:.b64 GLOBAL
|
||||
; CHECK-NEXT:.b8 3 // Abbrev [3] 0x7f:0x7 DW_TAG_base_type
|
||||
; CHECK-NEXT:.b8 105 // DW_AT_name
|
||||
; CHECK-NEXT:.b8 110
|
||||
; CHECK-NEXT:.b8 116
|
||||
; CHECK-NEXT:.b8 0
|
||||
; CHECK-NEXT:.b8 5 // DW_AT_encoding
|
||||
; CHECK-NEXT:.b8 4 // DW_AT_byte_size
|
||||
; CHECK-NEXT:.b8 2 // Abbrev [2] 0x86:0x1a DW_TAG_variable
|
||||
; CHECK-NEXT:.b8 83 // DW_AT_name
|
||||
; CHECK-NEXT:.b8 72
|
||||
; CHECK-NEXT:.b8 65
|
||||
; CHECK-NEXT:.b8 82
|
||||
; CHECK-NEXT:.b8 69
|
||||
; CHECK-NEXT:.b8 68
|
||||
; CHECK-NEXT:.b8 0
|
||||
; CHECK-NEXT:.b32 127 // DW_AT_type
|
||||
; CHECK-NEXT:.b8 1 // DW_AT_external
|
||||
; CHECK-NEXT:.b8 1 // DW_AT_decl_file
|
||||
; CHECK-NEXT:.b8 4 // DW_AT_decl_line
|
||||
; CHECK-NEXT:.b8 8 // DW_AT_address_class
|
||||
; CHECK-NEXT:.b8 9 // DW_AT_location
|
||||
; CHECK-NEXT:.b8 3
|
||||
; CHECK-NEXT:.b64 SHARED
|
||||
; CHECK-NEXT:.b8 4 // Abbrev [4] 0xa0:0x45 DW_TAG_subprogram
|
||||
; CHECK-NEXT:.b64 Lfunc_begin0 // DW_AT_low_pc
|
||||
; CHECK-NEXT:.b64 Lfunc_end0 // DW_AT_high_pc
|
||||
; CHECK-NEXT:.b8 1 // DW_AT_frame_base
|
||||
; CHECK-NEXT:.b8 156
|
||||
; CHECK-NEXT:.b8 116 // DW_AT_MIPS_linkage_name
|
||||
; CHECK-NEXT:.b8 101
|
||||
; CHECK-NEXT:.b8 115
|
||||
; CHECK-NEXT:.b8 116
|
||||
; CHECK-NEXT:.b8 0
|
||||
; CHECK-NEXT:.b8 116 // DW_AT_name
|
||||
; CHECK-NEXT:.b8 101
|
||||
; CHECK-NEXT:.b8 115
|
||||
; CHECK-NEXT:.b8 116
|
||||
; CHECK-NEXT:.b8 0
|
||||
; CHECK-NEXT:.b8 1 // DW_AT_decl_file
|
||||
; CHECK-NEXT:.b8 6 // DW_AT_decl_line
|
||||
; CHECK-NEXT:.b8 1 // DW_AT_external
|
||||
; CHECK-NEXT:.b8 5 // Abbrev [5] 0xc0:0x9 DW_TAG_formal_parameter
|
||||
; CHECK-NEXT:.b8 97 // DW_AT_name
|
||||
; CHECK-NEXT:.b8 0
|
||||
; CHECK-NEXT:.b8 1 // DW_AT_decl_file
|
||||
; CHECK-NEXT:.b8 6 // DW_AT_decl_line
|
||||
; CHECK-NEXT:.b32 234 // DW_AT_type
|
||||
; CHECK-NEXT:.b8 5 // Abbrev [5] 0xc9:0x9 DW_TAG_formal_parameter
|
||||
; CHECK-NEXT:.b8 120 // DW_AT_name
|
||||
; CHECK-NEXT:.b8 0
|
||||
; CHECK-NEXT:.b8 1 // DW_AT_decl_file
|
||||
; CHECK-NEXT:.b8 6 // DW_AT_decl_line
|
||||
; CHECK-NEXT:.b32 229 // DW_AT_type
|
||||
; CHECK-NEXT:.b8 5 // Abbrev [5] 0xd2:0x9 DW_TAG_formal_parameter
|
||||
; CHECK-NEXT:.b8 121 // DW_AT_name
|
||||
; CHECK-NEXT:.b8 0
|
||||
; CHECK-NEXT:.b8 1 // DW_AT_decl_file
|
||||
; CHECK-NEXT:.b8 6 // DW_AT_decl_line
|
||||
; CHECK-NEXT:.b32 229 // DW_AT_type
|
||||
; CHECK-NEXT:.b8 5 // Abbrev [5] 0xdb:0x9 DW_TAG_formal_parameter
|
||||
; CHECK-NEXT:.b8 105 // DW_AT_name
|
||||
; CHECK-NEXT:.b8 0
|
||||
; CHECK-NEXT:.b8 1 // DW_AT_decl_file
|
||||
; CHECK-NEXT:.b8 6 // DW_AT_decl_line
|
||||
; CHECK-NEXT:.b32 127 // DW_AT_type
|
||||
; CHECK-NEXT:.b8 0 // End Of Children Mark
|
||||
; CHECK-NEXT:.b8 6 // Abbrev [6] 0xe5:0x5 DW_TAG_pointer_type
|
||||
; CHECK-NEXT:.b32 234 // DW_AT_type
|
||||
; CHECK-NEXT:.b8 3 // Abbrev [3] 0xea:0x9 DW_TAG_base_type
|
||||
; CHECK-NEXT:.b8 102 // DW_AT_name
|
||||
; CHECK-NEXT:.b8 108
|
||||
; CHECK-NEXT:.b8 111
|
||||
; CHECK-NEXT:.b8 97
|
||||
; CHECK-NEXT:.b8 116
|
||||
; CHECK-NEXT:.b8 0
|
||||
; CHECK-NEXT:.b8 4 // DW_AT_encoding
|
||||
; CHECK-NEXT:.b8 4 // DW_AT_byte_size
|
||||
; CHECK-NEXT:.b8 0 // End Of Children Mark
|
||||
; CHECK-NEXT: }
|
||||
; CHECK-NEXT: .section .debug_loc { }
|
||||
; CHECK-NOT: debug_
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -13,11 +13,11 @@ define void @patatino(i64 %n, i64 %i, %struct.S* %p) !dbg !7 {
|
||||
; CHECK-NEXT: call void @llvm.dbg.value(metadata i64 [[I:%.*]], metadata !19, metadata !DIExpression()), !dbg !24
|
||||
; CHECK-NEXT: call void @llvm.dbg.value(metadata %struct.S* [[P:%.*]], metadata !20, metadata !DIExpression()), !dbg !25
|
||||
; CHECK-NEXT: [[X1:%.*]] = getelementptr inbounds [[STRUCT_S:%.*]], %struct.S* [[P]], i64 [[N]], i32 0, !dbg !26
|
||||
; CHECK-NEXT: call void @llvm.dbg.value(metadata !2, metadata !21, metadata !DIExpression()), !dbg !27
|
||||
; CHECK-NEXT: call void @llvm.dbg.value(metadata i64 undef, metadata !21, metadata !DIExpression()), !dbg !27
|
||||
; CHECK-NEXT: [[Y3:%.*]] = getelementptr inbounds [[STRUCT_S]], %struct.S* [[P]], i64 [[N]], i32 1, !dbg !28
|
||||
; CHECK-NEXT: [[TMP0:%.*]] = bitcast i64* [[X1]] to <2 x i64>*, !dbg !26
|
||||
; CHECK-NEXT: [[TMP1:%.*]] = load <2 x i64>, <2 x i64>* [[TMP0]], align 8, !dbg !26, !tbaa !29
|
||||
; CHECK-NEXT: call void @llvm.dbg.value(metadata !2, metadata !22, metadata !DIExpression()), !dbg !33
|
||||
; CHECK-NEXT: call void @llvm.dbg.value(metadata i64 undef, metadata !22, metadata !DIExpression()), !dbg !33
|
||||
; CHECK-NEXT: [[X5:%.*]] = getelementptr inbounds [[STRUCT_S]], %struct.S* [[P]], i64 [[I]], i32 0, !dbg !34
|
||||
; CHECK-NEXT: [[Y7:%.*]] = getelementptr inbounds [[STRUCT_S]], %struct.S* [[P]], i64 [[I]], i32 1, !dbg !35
|
||||
; CHECK-NEXT: [[TMP2:%.*]] = bitcast i64* [[X5]] to <2 x i64>*, !dbg !36
|
||||
|
@ -17,11 +17,11 @@ entry:
|
||||
%1 = bitcast i32* %x2 to i8*, !dbg !14
|
||||
|
||||
; Unhandled dbg.value: expression does not start with OP_DW_deref
|
||||
; CHECK: call void @llvm.dbg.value(metadata ![[EMPTY:.*]], metadata !{{.*}}, metadata !{{.*}})
|
||||
; CHECK: call void @llvm.dbg.value(metadata i32* undef, metadata !{{.*}}, metadata !{{.*}})
|
||||
tail call void @llvm.dbg.value(metadata i32* %x1, metadata !10, metadata !23), !dbg !16
|
||||
|
||||
; Unhandled dbg.value: expression does not start with OP_DW_deref
|
||||
; CHECK: call void @llvm.dbg.value(metadata ![[EMPTY]], metadata !{{.*}}, metadata !{{.*}})
|
||||
; CHECK: call void @llvm.dbg.value(metadata i32* undef, metadata !{{.*}}, metadata !{{.*}})
|
||||
tail call void @llvm.dbg.value(metadata i32* %x1, metadata !10, metadata !24), !dbg !16
|
||||
|
||||
; Supported dbg.value: rewritted based on the [[USP]] value.
|
||||
@ -33,8 +33,8 @@ entry:
|
||||
tail call void @llvm.dbg.value(metadata i32* %x1, metadata !10, metadata !15), !dbg !16
|
||||
call void @capture(i32* nonnull %x1), !dbg !17
|
||||
|
||||
; An extra non-dbg.value metadata use of %x2. Replaced with an empty metadata.
|
||||
; CHECK: call void @llvm.random.metadata.use(metadata ![[EMPTY]])
|
||||
; An extra non-dbg.value metadata use of %x2. Replaced with undef.
|
||||
; CHECK: call void @llvm.random.metadata.use(metadata i32* undef
|
||||
call void @llvm.random.metadata.use(metadata i32* %x2)
|
||||
|
||||
; CHECK: call void @llvm.dbg.value(metadata i8* %[[USP]], metadata ![[X2:.*]], metadata !DIExpression(DW_OP_constu, 8, DW_OP_minus, DW_OP_deref))
|
||||
@ -69,7 +69,6 @@ attributes #4 = { nounwind }
|
||||
!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !1, producer: "clang version 3.9.0 (trunk 271022) (llvm/trunk 271027)", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2)
|
||||
!1 = !DIFile(filename: "../llvm/2.cc", directory: "/code/build-llvm")
|
||||
|
||||
; CHECK-DAG: ![[EMPTY]] = !{}
|
||||
!2 = !{}
|
||||
!3 = !{i32 2, !"Dwarf Version", i32 4}
|
||||
!4 = !{i32 2, !"Debug Info Version", i32 3}
|
||||
|
@ -9,10 +9,12 @@
|
||||
#include "llvm/IR/DebugInfo.h"
|
||||
#include "llvm/AsmParser/Parser.h"
|
||||
#include "llvm/IR/DebugInfoMetadata.h"
|
||||
#include "llvm/IR/IntrinsicInst.h"
|
||||
#include "llvm/IR/LLVMContext.h"
|
||||
#include "llvm/IR/Module.h"
|
||||
#include "llvm/IR/Verifier.h"
|
||||
#include "llvm/Support/SourceMgr.h"
|
||||
#include "llvm/Transforms/Utils/Local.h"
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
using namespace llvm;
|
||||
@ -145,4 +147,42 @@ TEST(StripTest, LoopMetadata) {
|
||||
EXPECT_FALSE(BrokenDebugInfo);
|
||||
}
|
||||
|
||||
TEST(MetadataTest, DeleteInstUsedByDbgValue) {
|
||||
LLVMContext C;
|
||||
std::unique_ptr<Module> M = parseIR(C, R"(
|
||||
define i16 @f(i16 %a) !dbg !6 {
|
||||
%b = add i16 %a, 1, !dbg !11
|
||||
call void @llvm.dbg.value(metadata i16 %b, metadata !9, metadata !DIExpression()), !dbg !11
|
||||
ret i16 0, !dbg !11
|
||||
}
|
||||
declare void @llvm.dbg.value(metadata, metadata, metadata) #0
|
||||
attributes #0 = { nounwind readnone speculatable willreturn }
|
||||
|
||||
!llvm.dbg.cu = !{!0}
|
||||
!llvm.module.flags = !{!5}
|
||||
|
||||
!0 = distinct !DICompileUnit(language: DW_LANG_C, file: !1, producer: "debugify", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2)
|
||||
!1 = !DIFile(filename: "t.ll", directory: "/")
|
||||
!2 = !{}
|
||||
!5 = !{i32 2, !"Debug Info Version", i32 3}
|
||||
!6 = distinct !DISubprogram(name: "foo", linkageName: "foo", scope: null, file: !1, line: 1, type: !7, scopeLine: 1, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !8)
|
||||
!7 = !DISubroutineType(types: !2)
|
||||
!8 = !{!9}
|
||||
!9 = !DILocalVariable(name: "1", scope: !6, file: !1, line: 1, type: !10)
|
||||
!10 = !DIBasicType(name: "ty16", size: 16, encoding: DW_ATE_unsigned)
|
||||
!11 = !DILocation(line: 1, column: 1, scope: !6)
|
||||
)");
|
||||
|
||||
// Find %b = add ...
|
||||
Instruction &I = *M->getFunction("f")->getEntryBlock().getFirstNonPHI();
|
||||
|
||||
// Find the dbg.value using %b.
|
||||
SmallVector<DbgValueInst *, 1> DVIs;
|
||||
findDbgValues(DVIs, &I);
|
||||
|
||||
// Delete %b. The dbg.value should now point to undef.
|
||||
I.eraseFromParent();
|
||||
EXPECT_TRUE(isa<UndefValue>(DVIs[0]->getValue()));
|
||||
}
|
||||
|
||||
} // end namespace
|
||||
|
Loading…
Reference in New Issue
Block a user