[llvm-dev] Duplicating node in SelectionDAG?

Ryan Taylor via llvm-dev llvm-dev at lists.llvm.org
Tue Sep 29 12:25:08 PDT 2015


It appears that it's impossible to duplicate a node in the dag. For
example, there is some code:

b = a * a; // a is a  global int

A LD node is generated for A and it goes into both Operand 0 and 1 of the
MUL node. The issue is I'm trying to match a pattern of:

set dstReg:$dstD  (OpNode (srcAType (load addr32:$srcA)), (srcBType (load
addr32:$srcB)))

so basically a mem, mem, reg operation.

The issue is this pattern won't match in the above example because there is
only one LD generated for 'a'. I tried to duplicate the LD in the dag but
it doesn't show up, it always reduces it to only one LD no matter what,
even if I have multiple loads in the IR also.

#1. Is it possible to duplicate an exact copy of a node in the dag?
#2. How would I go about matching this pattern in table gen?

Thanks.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20150929/d453b3fa/attachment.html>


More information about the llvm-dev mailing list