[PATCH] D105279: [RemoveRedundantDebugValues] Introduce a MIR pass that removes redundant DBG_VALUEs

Djordje Todorovic via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 9 03:16:59 PDT 2021


djtodoro added a comment.

In D105279#2866384 <https://reviews.llvm.org/D105279#2866384>, @StephenTozer wrote:

> In D105279#2865319 <https://reviews.llvm.org/D105279#2865319>, @aprantl wrote:
>
>> You probably also considered adding this functionality to MIBuilder or LiveDebugVariables itself, to avoid inserting duplicates in the first place. Would that be possible, or is there no good place in the existing code where we could add this to?
>
> There was a previous patch up to this effect (D105025 <https://reviews.llvm.org/D105025>) that was abandoned due to performance concerns; scanning (potentially) the full basic block at insertion for every `DBG_VALUE` would be a quadratic solution, while this pass is linear. It would be possible to produce an optimized version using caching in LiveDebugVariables/LiveDebugValues (although probably not `MIBuilder`), but since they would all be linear time anyway I'm happier with the solution that has less complexity and doesn't insert more into two passes that are already quite dense.

Yep, +1.



================
Comment at: llvm/test/DebugInfo/NVPTX/debug-loc-offset.ll:250
+; CHECK-NEXT: .b8 0                                // EOM(2)
+; CHECK-NEXT: .b8 8                                // Abbreviation Code
 ; CHECK-NEXT: .b8 36                               // DW_TAG_base_type
----------------
aprantl wrote:
> Why did this change, is it because the order in which the DBG_VALUEs are processed is different now?
Now we have a new abbrev since the parameter becomes `DW_AT_const_value`:

   ...
     (1)  DBG_VALUE 0, $noreg, !13, !DIExpression(), debug-location !14
     (2) DBG_VALUE 1, $noreg, !13, !DIExpression(), debug-location !14
   ...

This will consider the (1) as redundant...is this OK?


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D105279/new/

https://reviews.llvm.org/D105279



More information about the llvm-commits mailing list