On Thursday 02 October 2008 15:37, Dan Gohman wrote:> 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.Yeah, I've been using those but they're real hard to understand with big graphs.> 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 > selected.That might be more helpful. Thanks for the tip! Which Select function are you referring to?> 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.Unfortunately, the testcase is about as simple as it can get: a loop with a gather, a multiply and a store. Maybe I can hand-whittle some IR.> And FWIW, there are some significant improvements in the > viewGraph() output in TOT :-).Yeah, I saw that. Unfortunately we won't get it until early next year, probably. :( -Dave
On Oct 2, 2008, at 2:15 PM, David Greene wrote:> On Thursday 02 October 2008 15:37, Dan Gohman wrote: >> >> 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 >> selected. > > That might be more helpful. Thanks for the tip! > > Which Select function are you referring to?For example, X86DAGToDAGISel::Select, for the x86 target.> > >> 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. > > Unfortunately, the testcase is about as simple as it can get: a loop > with a > gather, a multiply and a store. Maybe I can hand-whittle some IR.Another trick is to place an abort() call somewhere in codegen such that it will be called whenever the construct of interest is processed, and then run bugpoint. If it works, the result is a reduced testcase that's still interesting :-). A feature that would be really useful for large graphs that LLVM doesn't yet have is the ability to display subsets of the graph. For example, take a node of interest and show just it and its operands and its users. Or maybe two or three or N levels of operands. Dan
On Thursday 02 October 2008 19:22, Dan Gohman wrote:> Another trick is to place an abort() call somewhere in codegen > such that it will be called whenever the construct of interest > is processed, and then run bugpoint. If it works, the result > is a reduced testcase that's still interesting :-).That's a neat trick. I'll see if I can do that.> A feature that would be really useful for large graphs that LLVM > doesn't yet have is the ability to display subsets of the graph. > For example, take a node of interest and show just it and its > operands and its users. Or maybe two or three or N levels of > operands.Yes, this would be helpful. I also looked at creating a setSubgraphColor method that would color the node and its children. But there doesn't seem to be a convenient way to traverse SelectionDAGs. It seems to be hard-coded by tblgen. -Dave