[llvm-commits] [PATCH] Fix tail calls (indirect or large-code-model): PR5729

Jon Harrop jon at ffconsultancy.com
Sat Jan 9 07:39:33 PST 2010


On Saturday 09 January 2010 01:53:17 Jeffrey Yasskin wrote:
> Bug: http://llvm.org/PR5729
> Patch: http://llvm.org/bugs/attachment.cgi?id=4017
> Review at: http://codereview.appspot.com/185044
>
> Dan's probably the right person to double-check my tests.
>
> Jon and Albert, this probably won't unbreak things for you guys yet
> since it doesn't change any behavior in -Asserts mode. I'll look for
> your runtime problems next.

Thanks for trying! I'm still seeing lots of bugs that seem to be TCO related 
and some (on x86) that seem to appear only with TCO and JIT at the same time 
(but not standalone compilation).

I just noticed an LLVM bug in TCO on x86-64 recently that was doing this:

$ ./hlvm
8x 8-queens
Queens
Queens
Queens
Queens
hlvm: X86ISelLowering.cpp:2006: virtual llvm::SDValue 
llvm::X86TargetLowering::LowerCall(llvm::SDValue, llvm::SDValue, unsigned 
int, bool, bool, const llvm::SmallVectorImpl<llvm::ISD::OutputArg>&, const 
llvm::SmallVectorImpl<llvm::ISD::InputArg>&, llvm::DebugLoc, 
llvm::SelectionDAG&, llvm::SmallVectorImpl<llvm::SDValue>&): Assertion 
`((Callee.getOpcode() == ISD::Register && 
(cast<RegisterSDNode>(Callee)->getReg() == X86::EAX || 
cast<RegisterSDNode>(Callee)->getReg() == X86::R9)) || Callee.getOpcode() == 
ISD::TargetExternalSymbol || Callee.getOpcode() == ISD::TargetGlobalAddress) 
&& "Expecting an global address, external symbol, or register"' failed.
Stack dump:
0.      Segmentation fault

I just upgraded to the latest LLVM SVN that I assume contains your fix but now 
I get this:

$ ./hlvm
hlvm: X86ISelLowering.cpp:2084: virtual llvm::SDValue 
llvm::X86TargetLowering::LowerCall(llvm::SDValue, llvm::SDValue, 
llvm::CallingConv::ID, bool, bool, const 
llvm::SmallVectorImpl<llvm::ISD::OutputArg>&, const 
llvm::SmallVectorImpl<llvm::ISD::InputArg>&, llvm::DebugLoc, 
llvm::SelectionDAG&, llvm::SmallVectorImpl<llvm::SDValue>&): Assertion 
`((Callee.getOpcode() == ISD::Register && 
(cast<RegisterSDNode>(Callee)->getReg() == X86::EAX || 
cast<RegisterSDNode>(Callee)->getReg() == X86::R9)) || Callee.getOpcode() == 
ISD::TargetExternalSymbol || Callee.getOpcode() == ISD::TargetGlobalAddress) 
&& "Expecting an global address, external symbol, or register"' failed.
Stack dump:
0.      Running pass 'X86 DAG->DAG Instruction Selection' on 
function '@"print_array_aux<`Int>"'
Aborted

I do think the situation is getting worse, probably because there are no TCO 
tests in the LLVM test suite so people don't know when they're breaking it. 
Can I give you the LLVM IR from some tests to put into LLVM's test suite?

-- 
Dr Jon Harrop, Flying Frog Consultancy Ltd.
http://www.ffconsultancy.com/?e



More information about the llvm-commits mailing list