[LLVMdev] Possible bug in TCO?
Dan Gohman
gohman at apple.com
Mon Nov 30 14:46:55 PST 2009
On Nov 30, 2009, at 1:21 PM, Dan Gohman wrote:
>
> On Nov 29, 2009, at 2:19 AM, Albert Graef wrote:
>
>> Have there been any changes to the x86-64 backend of the JIT which might
>> break tail call elimination? I didn't see any announcements about major
>> changes in the JIT on the ml, so I have no idea what might be going
>> wrong there.
>
> I haven't tested it, but the following pattern in X86Instr64bit.td
> looks suspicious as it appears to attempt to support direct tailcalls
> to arbitrary 64-bit immediates:
>
> def : Pat<(X86tcret GR64:$dst, imm:$off),
> (TCRETURNri64 GR64:$dst, imm:$off)>;
Arnold pointed out to me that I was mistaken here; this offset is a
stack offset, so it's not the kind of thing I was looking for.
With the recent changes to support regular calls where the callee is not
within range for a 32-bit immediate on 64-bit targets, my suspicion was
that perhaps tailcalls needed similar fixing, but at another glance I
don't see anything obviously wrong there. It would be interesting if
someone could look at one of the segfaults in a debugger and determine
which address its trying to jump to, and compare that with the actual
address of the intended callee.
Dan
More information about the llvm-dev
mailing list