This is an archive of the discontinued LLVM Phabricator instance.

[SelectionDAG] Updates for -dag-dump-verbose
ClosedPublic

Authored by bjope on Jan 16 2019, 9:31 AM.

Details

Summary

This patch makes some changes related to -dag-dump-verbose.
Main use case has been when debugging how SelectionDAG is
dealing with debug info (SDDbgValue nodes).

  1. We now print the number of DbgValues that are mapped to each SDNode.
  2. Removed duplicated printing of DebugLoc (nowadays DebugLoc is printed also when not using -dag-dump-verbose).
  3. Renamed SDDbgValue::dump to SDDbgValue::print, and added a new SDDbgValue::dump that will start a new line after calling print.
  4. SDDbgValue::print now prints "Order", and it also prints some additional information when kind is CONST/FRAMEIX/VREG.
  5. SelectionDAG::dump() now dumps all SDDbgValue nodes after the list of SDNodes (both "regular" and "ByVal" SDDbgValue:s). Invalidated nodes are not printed.
  6. Prohibit inline printing of SDNode operands that has SDDbgValue nodes associated to them.

Diff Detail

Repository
rL LLVM

Event Timeline

bjope created this revision.Jan 16 2019, 9:31 AM
bjope added a comment.Jan 16 2019, 9:41 AM

@jmorse : Since you are working a little bit with the SelectionDAGBuilder and debug values etc, maybe you will find this patch helpful. It gives some more printouts for the "missing" DBG_VALUE nodes that normally isn't shown during ISel simply by using -debug or -dag-dump-verbose.

Before submitting this we need to decide upon a few things, such as:

  1. should this be a separate option or could it simply be part of -dag-dump-verbose
  2. should we convert -dag-dump-verbose into some multi-choice param with different verbosity levels

Maybe (1) is an acceptable solution.

Not sure about what kind of test cases that are needed for these. I haven't seen any test cases for -dag-dump-verbose so maybe it isn't that important to have tests for this kind of debugging aid?

Hi Bjorn, this is highly useful and relevant to my interests,

Before submitting this we need to decide upon a few things, such as:

  1. should this be a separate option or could it simply be part of -dag-dump-verbose
  2. should we convert -dag-dump-verbose into some multi-choice param with different verbosity levels

IMHO this can be rolled into -dag-dump-verbose: for the normal use cases the user won't have any dbg.values, or should be able to trivially drop them if they don't want this information cluttering output.

Not sure about what kind of test cases that are needed for these. I haven't seen any test cases for -dag-dump-verbose so maybe it isn't that important to have tests for this kind of debugging aid?

I suspect no test is required (although I doubt it's written down anywhere). It'd be awkward to break someones CI testing because a non-functional textual representation changed. I've also seen a couple of reviews disallowing the use of -debug output to test the compiler behaviour.

include/llvm/CodeGen/SelectionDAG.h
1355–1357 ↗(On Diff #182073)

Doesn't compile for me, the other GetDbgValues method is already const, so this only overloads the return type which C++ disallows.

1364–1367 ↗(On Diff #182073)

Is it worth just removing the non-const DbgBegin/End here, as we return the same iterators anyway?

bjope marked an inline comment as done.Jan 17 2019, 9:03 AM
bjope added inline comments.
include/llvm/CodeGen/SelectionDAG.h
1355–1357 ↗(On Diff #182073)

Ok. Sorry. I resurrected this from some old branch and forgot to verify that it works on latest trunk.
But since it seems useful I'll cleanup this a little bit (and of course making sure it compiles again).

bjope updated this revision to Diff 182408.Jan 17 2019, 3:52 PM

Now refactored based on trunk (the first version I uploaded was a
quite old patch that didn't even compile, sorry for that).

I also removed the part about letting SelectionDAG::dump() dump
all SDNodes (even the single-use nodes normally printed inline)
on separate lines. I've always found it a little bit confusing
that it says "SelectionDAG has 22 nodes:" and then it prints
what seems to be less than 22 nodes, due to some being printed
inline (and the node id is not printed for the inlined ones).
I'm thinking about adding a new option for disabling the
inline printing, but that will go in a separate patch (it is
not really related to -dag-dump-verbose).

bjope updated this revision to Diff 182508.Jan 18 2019, 6:31 AM

Some more updates (some tweaks after having looked at some logs).

bjope retitled this revision from [SelectionDAG] Add option -dag-dump-verbose-dbg to [SelectionDAG] Updates for -dag-dump-verbose.Jan 18 2019, 6:33 AM
bjope edited the summary of this revision. (Show Details)
bjope added a reviewer: aprantl.
aprantl accepted this revision.Jan 18 2019, 10:12 AM
This revision is now accepted and ready to land.Jan 18 2019, 10:12 AM
This revision was automatically updated to reflect the committed changes.