Skip to content

Commit adace79

Browse files
committed
[DebugInfo] Enable variadic debug value salvaging
This patch enables the salvaging of debug values that may be calculated from more than one SSA value, such as with binary operators that do not use a constant argument. The actual functionality for this behaviour is added in a previous commit (c727056), but with the ability to actually emit the resulting debug values switched off. The reason for this is that the prior patch has been reverted several times due to issues discovered downstream, some time after the actual landing of the patch. The patch in question is rather large and touches several widely used header files, and all issues discovered are more related to the handling of variadic debug values as a whole rather than the details of the patch itself. Therefore, to minimize the build time impact and risk of conflicts involved in any potential future revert/reapply of that patch, this significantly smaller patch (that touches no header files) will instead be used as the capstone to enable variadic debug value salvaging. The review linked to this patch is mostly implemented by the previous commit, c727056, but also contains the changes in this patch. Differential Revision: https://reviews.llvm.org/D91722
1 parent 1113e06 commit adace79

File tree

4 files changed

+7
-11
lines changed

4 files changed

+7
-11
lines changed

llvm/lib/Transforms/Utils/Local.cpp

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1748,11 +1748,7 @@ void llvm::salvageDebugInfoForDbgValues(
17481748
} else if (isa<DbgValueInst>(DII) &&
17491749
DII->getNumVariableLocationOps() + AdditionalValues.size() <=
17501750
MaxDebugArgs) {
1751-
// TODO: Uncomment the line below and delete the two beneath it to enable
1752-
// salvaging of dbg.values with multiple location operands.
1753-
// DII->addVariableLocationOps(AdditionalValues, SalvagedExpr);
1754-
Value *Undef = UndefValue::get(I.getOperand(0)->getType());
1755-
DII->replaceVariableLocationOp(I.getOperand(0), Undef);
1751+
DII->addVariableLocationOps(AdditionalValues, SalvagedExpr);
17561752
} else {
17571753
// Do not salvage using DIArgList for dbg.addr/dbg.declare, as it is
17581754
// currently only valid for stack value expressions.

llvm/test/DebugInfo/NVPTX/debug-info.ll

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -702,12 +702,12 @@ if.end: ; preds = %if.then, %entry
702702
; CHECK-NEXT: }
703703
; CHECK-NEXT: .section .debug_info
704704
; CHECK-NEXT: {
705-
; CHECK-NEXT:.b32 10029 // Length of Unit
705+
; CHECK-NEXT:.b32 10034 // Length of Unit
706706
; CHECK-NEXT:.b8 2 // DWARF version number
707707
; CHECK-NEXT:.b8 0
708708
; CHECK-NEXT:.b32 .debug_abbrev // Offset Into Abbrev. Section
709709
; CHECK-NEXT:.b8 8 // Address Size (in bytes)
710-
; CHECK-NEXT:.b8 1 // Abbrev [1] 0xb:0x2726 DW_TAG_compile_unit
710+
; CHECK-NEXT:.b8 1 // Abbrev [1] 0xb:0x272b DW_TAG_compile_unit
711711
; CHECK-NEXT:.b8 0 // DW_AT_producer
712712
; CHECK-NEXT:.b8 4 // DW_AT_language
713713
; CHECK-NEXT:.b8 0
@@ -8306,7 +8306,7 @@ if.end: ; preds = %if.then, %entry
83068306
; CHECK-NEXT:.b8 3 // DW_AT_decl_line
83078307
; CHECK-NEXT:.b32 3345 // DW_AT_type
83088308
; CHECK-NEXT:.b8 0 // End Of Children Mark
8309-
; CHECK-NEXT:.b8 40 // Abbrev [40] 0x2671:0xbf DW_TAG_subprogram
8309+
; CHECK-NEXT:.b8 40 // Abbrev [40] 0x2671:0xc4 DW_TAG_subprogram
83108310
; CHECK-NEXT:.b64 Lfunc_begin0 // DW_AT_low_pc
83118311
; CHECK-NEXT:.b64 Lfunc_end0 // DW_AT_high_pc
83128312
; CHECK-NEXT:.b8 1 // DW_AT_frame_base
@@ -8386,7 +8386,7 @@ if.end: ; preds = %if.then, %entry
83868386
; CHECK-NEXT:.b8 12 // DW_AT_call_file
83878387
; CHECK-NEXT:.b8 6 // DW_AT_call_line
83888388
; CHECK-NEXT:.b8 37 // DW_AT_call_column
8389-
; CHECK-NEXT:.b8 43 // Abbrev [43] 0x2711:0x1e DW_TAG_inlined_subroutine
8389+
; CHECK-NEXT:.b8 43 // Abbrev [43] 0x2711:0x23 DW_TAG_inlined_subroutine
83908390
; CHECK-NEXT:.b32 9791 // DW_AT_abstract_origin
83918391
; CHECK-NEXT:.b64 Ltmp9 // DW_AT_low_pc
83928392
; CHECK-NEXT:.b64 Ltmp10 // DW_AT_high_pc
@@ -8395,6 +8395,8 @@ if.end: ; preds = %if.then, %entry
83958395
; CHECK-NEXT:.b8 5 // DW_AT_call_column
83968396
; CHECK-NEXT:.b8 44 // Abbrev [44] 0x2729:0x5 DW_TAG_formal_parameter
83978397
; CHECK-NEXT:.b32 9820 // DW_AT_abstract_origin
8398+
; CHECK-NEXT:.b8 44 // Abbrev [44] 0x272e:0x5 DW_TAG_formal_parameter
8399+
; CHECK-NEXT:.b32 9829 // DW_AT_abstract_origin
83988400
; CHECK-NEXT:.b8 0 // End Of Children Mark
83998401
; CHECK-NEXT:.b8 0 // End Of Children Mark
84008402
; CHECK-NEXT:.b8 0 // End Of Children Mark

llvm/test/DebugInfo/salvage-gep.ll

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
; XFAIL: *
21
; RUN: opt %s -dce -S | FileCheck %s
32

43
; Tests the salvaging of GEP instructions, specifically struct indexing and

llvm/test/DebugInfo/salvage-nonconst-binop.ll

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
; XFAIL: *
21
; RUN: opt %s -dce -S | FileCheck %s
32

43
; Tests the salvaging of binary operators that use more than one non-constant

0 commit comments

Comments
 (0)