[llvm] [RFC] implement convergence control in MIR using SelectionDAG (PR #71785)

Sameer Sahasrabuddhe via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 18 00:17:53 PST 2023


ssahasra wrote:

> > @arsenm do you see any potential pitfalls in how the glue node is being passed around? The glue is needed only on intrinsics, and there are a couple of FIXME comments about the possibility of some intrinsic having multiple glue nodes. Also, at one point, SelectNodeTo() loses the glue node, so this change first stashes the node, then calls SelectNodeTo(), and then adds the glue node back with MorphNodeTo().
> 
> This seems like just a bug in SelectNodeTo. Glue shouldn't just get lost, that kind of defeats the purpose

I gave the wrong impression earlier. The problem is ``SelectCode``, which is generated from TD patterns. ``AMDGPUTargetLowering::CollectTargetIntrinsicOperands()`` appends an extra CONVERGENCECTRL_GLUE operand to the node, which is ignored by the generated selection code. Doing it right will require adding the token operand to every convergent opcode in our TD files. The easier hack is to just restore the token using ``MorphNodeTo()`` after calling ``SelectCode()``.

Or there is a very real possibility that I misunderstood how glue nodes are used?

https://github.com/llvm/llvm-project/pull/71785


More information about the llvm-commits mailing list