[llvm-commits] Bug in the DAG legalizer?

Rafael Espindola espindola at google.com
Fri Aug 17 09:07:34 PDT 2007

I am trying to implement the calling of functions with byval
arguments. The attached patch has the work in progress.

The problem is that it creates a MEMCPY node to do the copying when
expanding a call with to a function with a byval argument. This
shouldn't be recursive, since memcpy has no byval arguments.

The sequence of expansions that is happening is:

*) the initial call is expanded
*) MEMCPY is expanded into a call to memcpy
*) the call to memcpy is expanded

The attached DAG reflects the state at this point. The problem with it
is that it has this structure


callseq_start               memcpy

The new callseq_start to the left is being constructed to replace the
memcpy, but when the legalizer search its parents it find previous
callseq_start. The legalizer then goes looking the callseq_end and
find the memcpy again, since this link hasn't been update yet. This
creates a infinity recursion that uses all memory.

Should I not be using a MEMCPY node? What should I use?

Rafael Avila de Espindola

Google Ireland Ltd.
Gordon House
Barrow Street
Dublin 4

Registered in Dublin, Ireland
Registration Number: 368047
-------------- next part --------------
A non-text attachment was scrubbed...
Name: llvm.patch
Type: text/x-patch
Size: 3216 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20070817/f4b1c0fb/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: dag.ps
Type: application/postscript
Size: 121437 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20070817/f4b1c0fb/attachment.ps>

More information about the llvm-commits mailing list