[llvm-dev] Selecting different instructions depending on addrspace() value

Tim Northover via llvm-dev llvm-dev at lists.llvm.org
Thu Mar 21 06:00:58 PDT 2019


Hi Gleb,

On Thu, 21 Mar 2019 at 12:36, Gleb Popov via llvm-dev
<llvm-dev at lists.llvm.org> wrote:
> It seems not possible to do that with usual "store" pattern fragment in .td file,

I think it ought to be possible without a custom ISD node. The AMDGPU
backend has a very similar situation and it looks like it has resolved
the problem by instantiating CodePatPred to check
cast<MemSDNode>(N)->getAddressSpace() as part of its patterns.

> The error I get:
>
> ISEL: Starting selection on root node: t15: ch = <<Unknown Target Node #278>> t13:1, Constant:i32<5>, FrameIndex:i32<-3>
> ISEL: Starting pattern match
>   Initial Opcode index to 4
>   Match failed at index 10

The best way to resolve these issues is to look at the table it's
referencing, in build/lib/Target/XYZ/XYZGenDAGISel.inc. The index
numbers mentioned in the error message appear as part of the comments
on each line, and you can usually use trace in the error work out
which pattern you expected to match and which predicate unexpectedly
failed.

My best guess from your post would be that the order of the pointer
and value operands appear to be swapped compared to a normal store. It
could still be right, depending on the contents of XYZISelLowering,
but is a little odd.

Cheers.

Tim.


More information about the llvm-dev mailing list