[PATCH] Stop putting operations after a tail call
Tim Northover
t.p.northover at gmail.com
Fri Jul 5 11:31:14 PDT 2013
Ping?
On Tue, Jul 2, 2013 at 8:25 PM, Tim Northover <t.p.northover at gmail.com> wrote:
> Hi,
>
> compnerd recently pointed out a disturbingly trivial failure when
> enabling tail calls on ARM Linux targets (though fortunately probably
> inaccessible from clang):
>
> declare i8* @g(i8*)
>
> define i8* @f(i8* %a) {
> entry:
> %0 = tail call i8* @g(i8* %a)
> ret i8* %0
> }
>
> When compiled at -O0 this hits an assertion failure[1]. There are many
> steps along the way, but I think the first objectively wrong decision
> is putting a tokenfactor for vreg exports (and hence possibly other
> operations) after the TC_RETURN instruction.
>
> The attached patch simply forgets about any pending vreg exports when
> a tail-call is encountered. Intuitively this seems like right (or at
> least harmless) behaviour, but I'm not familiar enough with FastISel
> to be sure.
>
> Does it seem reasonable?
>
> Cheers.
>
> Tim.
>
> [1] Via Schroedinger's FastISel; not supported on Thumb Linux but
> still gets vregs set ready for it.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: remove-defs-after-tail.diff
Type: application/octet-stream
Size: 1722 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20130705/48ff0ad8/attachment.obj>
More information about the llvm-commits
mailing list