[PATCH] D35267: Pass Divergence Analysis data to selection DAG to drive divergence dependent instruction selection

Alexander via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 29 05:01:16 PST 2018


alex-t added a comment.

In https://reviews.llvm.org/D35267#985601, @efriedma wrote:

> > Please also note that this addition does not depend on "tid" or any other divergent data. It is not possible to discover this dependency analyzing individual block. We need CFG information.
>
> Yes, this is what I was getting at with "We should query the IR DivergenceAnalysis to compute isSDNodeSourceOfDivergence for a CopyFromReg from a live-in virtual register."; the nodes which need CFG information are precisely CopyFromReg nodes from virtual registers.  Each virtual register created by the SelectionDAGBuilder should correspond to exactly one IR instruction.


In general this would work but we still have several issues:

As I understand you are concerned about the mutating the SDNode after it has been created in getNode().

1. FunctionLoweringInfo::ValueMap is created during the SelectionDAGBuilder walk through the BasicBlock. So we cannot query live-in register divergence from the CreateOperands => TargetLoweringInfo::isSDNodeSourceOfDivergence. By this point ValueMap has not yet been filled in.
2. Even if we able to count control dependencies from the SelectionDAGBuilder we would have a mean to propagate the flag value through the DAG along the data dependency edges.

All above means that we cannot just validate the flag values and assert if it does not match. We have to run iterative solver for each block just before the selection to count the control dependencies and to propagate the flag values.

I tried this approach and it works at a first glance.


https://reviews.llvm.org/D35267





More information about the llvm-commits mailing list