[llvm-dev] Selection DAG chain question

Björn Pettersson A via llvm-dev
Fri, 17 Jul 2020 16:55:27 -0000

Still sounds to me as Glue might help (as already proposed by Craig), but maybe
I’ve misunderstood something.

Another option is to do a simple lowering into pseudo instructions that you
expand after ISel.
(might be easier than doing something before ISel and then having to bother
about chains, glue etc)

Regards,
Björn

From: llvm-dev <llvm-dev-bounces at lists.llvm.org> On Behalf Of Hendrik
Greving via llvm-dev
Sent: den 16 juli 2020 23:35
To: Matt Arsenault <arsenm2 at gmail.com>
Cc: llvm-dev <llvm-dev at lists.llvm.org>
Subject: Re: [llvm-dev] Selection DAG chain question

Yea. I think AMD chains the node they're expanding into, but they don't
chain it into an _existing_ chain. e.g. adding A->B to the DAG is ok. But
adding A->B and next C->D with B->C is the problem. I appreciate the
input

On Thu, Jul 16, 2020 at 2:04 PM Matt Arsenault <arsenm2 at
gmail.com<mailto:arsenm2 at gmail.com>> wrote:


> On Jul 16, 2020, at 17:00, Hendrik Greving <hgreving at
google.com<mailto:hgreving at google.com>> wrote:
>
> > No, non-sideeffecting operations can be legalized as compiler-rt calls
>
> Right, but not as "regular" nodes with side-effects? I guess you
could search and analyze the DAG manually but that seems hacky. Maybe something
that one day LLVM could support natively.


You can’t add arbitrary chains or glue to the regular nodes, but you can define
a custom node you select the same way with your chain/glue. You don’t need to
preprocess the IR and can do in the custom lowering. This is what AMDGPU does
for FDIV (see AMDGPUISD::FMA_W_CHAIN). GlobalISel avoids these complications by
not having nodes or chains, and just instructions with side effects, so in that
sense this is a solved problem.

-Matt
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://lists.llvm.org/pipermail/llvm-dev/attachments/20200717/9282b2d1/attachment.html>