[LLVMdev] Making Sense of ISel DAG Output

Dan Gohman gohman at apple.com
Thu Oct 2 13:37:07 PDT 2008

On Oct 2, 2008, at 9:37 AM, David Greene wrote:

> I'm debugging some X86 patterns and I want to understand the debug  
> dumps from
> isel better.
> Here's some example output:
>  0x391bc40: i64,ch = load 0x3922c50, 0x391b8d0, 0x38dc530  
> <0x39053e0:0> <sext
> i32> alignment=4 srcLineNum= 10
>    0x3922c50: <multiple use>
>          0x391bc40: <multiple use>
>          0x3856ab0: <multiple use>
>        0x3914520: i64 = shl 0x391bc40, 0x3856ab0 srcLineNum= 10
>        0x38569b0: <multiple use>
>      0x391bdf0: i64 = add 0x3914520, 0x38569b0 srcLineNum= 10
>      0x39127c0: <multiple use>
>    0x3913dd0: i64 = add 0x391bdf0, 0x39127c0 srcLineNum= 10
>    0x38dc530: <multiple use>
>  0x391bf40: f64,ch = load 0x3922c50, 0x3913dd0, 0x38dc530  
> <0x3850d30:0>
> alignment=8 srcLineNum= 10
> I think I've figured out that lines with greater indent feed lines  
> with lesser
> indent.  So for example, the final load is fed by three operands:  
> 0x3922c50,
> 0x3913dd0  and 0x38dc530.  And <multiple use> seems to mean a node  
> that feeds
> many nodes.
> Is this understanding correct?

I think so, though I don't actually look at the SelectionDAG
dump() output very often.

I highly recommend the viewGraph() output.  -view-isel-dags and
-view-sched-dags show the graph before and after selection,
respectively. See the CodeGen docs where I recently added some
text describing all these options.

Also, you can call viewGraph() from within a debugger, to view
the graph at arbitrary point in the middle of the selection
process. You can can even put a breakpoint on the Select
function and view the graph as each individual instruction is

It can get hairy with really large graphs, but if you're trying
to understand instruction selection, it's often possible to reduce
the testcases to a readable scale while still including the
interesting parts. SelectionDAG's setGraphColor method can also
help when graphs get large.

And FWIW, there are some significant improvements in the
viewGraph() output in TOT :-).


More information about the llvm-dev mailing list