LLVM Bugzilla is read-only and represents the historical archive of all LLVM issues filled before November 26, 2021. Use github to submit LLVM bugs

Bug 5729 - Certain tail calls cause assertion failure
Summary: Certain tail calls cause assertion failure
Status: RESOLVED FIXED
Alias: None
Product: libraries
Classification: Unclassified
Component: Backend: X86 (show other bugs)
Version: trunk
Hardware: PC Linux
: P normal
Assignee: Jeffrey Yasskin
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-12-08 19:27 PST by Jeffrey Yasskin
Modified: 2010-01-09 13:06 PST (History)
3 users (show)

See Also:
Fixed By Commit(s):


Attachments
Crashing tail call (1.02 KB, text/plain)
2009-12-08 19:27 PST, Jeffrey Yasskin
Details
test/CodeGen/X86/tailcall-largecode.ll (356 bytes, text/plain)
2010-01-08 16:24 PST, Jeffrey Yasskin
Details
Fix: changed R9 to R11 in the assert (3.87 KB, patch)
2010-01-08 19:39 PST, Jeffrey Yasskin
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jeffrey Yasskin 2009-12-08 19:27:35 PST
Created attachment 3929 [details]
Crashing tail call

The attached IR crashes on x86-64 with the following assertion error:

$ Debug/bin/llvm-as ~/tmp/lli_crash.ll
$ Debug/bin/lli -disable-lazy-compilation ~/tmp/lli_crash.bc
$ gdb --args Debug/bin/lli -tailcallopt -disable-lazy-compilation ~/tmp/lli_crash.bc
(gdb) run
Starting program: /usr/local/google/jyasskin/llvm/trunk/obj/Debug/bin/lli -tailcallopt -disable-lazy-compilation /home/jyasskin/tmp/lli_crash.bc
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".
lli: /usr/local/google/jyasskin/llvm/trunk/src/lib/Target/X86/X86ISelLowering.cpp:2072: 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.

Program received signal SIGABRT, Aborted.
0x00007ffff6813095 in raise () from /lib/libc.so.6
(gdb) bt
#0  0x00007ffff6813095 in raise () from /lib/libc.so.6
#1  0x00007ffff6814af0 in abort () from /lib/libc.so.6
#2  0x00007ffff680c2df in __assert_fail () from /lib/libc.so.6
#3  0x0000000000ad5cbe in llvm::X86TargetLowering::LowerCall (this=0x1675348, Chain=..., 
    Callee=..., CallConv=llvm::CallingConv::Fast, isVarArg=false, isTailCall=true, 
    Outs=..., Ins=..., dl=..., DAG=..., InVals=...)
    at /usr/local/google/jyasskin/llvm/trunk/src/lib/Target/X86/X86ISelLowering.cpp:2067
#4  0x0000000000bba289 in llvm::TargetLowering::LowerCallTo (this=0x1675348, Chain=..., 
    RetTy=0x166c7d0, RetSExt=false, RetZExt=false, isVarArg=false, isInreg=false, 
    NumFixedArgs=1, CallConv=llvm::CallingConv::Fast, isTailCall=true, 
    isReturnValueUsed=true, Callee=..., 
    Args=std::vector of length 1, capacity 1 = {...}, DAG=..., dl=...)
    at /usr/local/google/jyasskin/llvm/trunk/src/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp:5428
#5  0x0000000000bc2843 in llvm::SelectionDAGBuilder::LowerCallTo (this=0x1699a00, 
    CS=..., Callee=..., isTailCall=true, LandingPad=0x0)
    at /usr/local/google/jyasskin/llvm/trunk/src/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp:4219
#6  0x0000000000bd2dd6 in llvm::SelectionDAGBuilder::visitCall (this=0x1699a00, I=...)
    at /usr/local/google/jyasskin/llvm/trunk/src/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp:4366
#7  0x0000000000bde98e in llvm::SelectionDAGBuilder::visit (this=0x1699a00, Opcode=45, 
    I=...) at /usr/local/google/jyasskin/llvm/trunk/src/include/llvm/Instruction.def:161
#8  0x0000000000bdea52 in llvm::SelectionDAGBuilder::visit (this=0x1699a00, I=...)
    at /usr/local/google/jyasskin/llvm/trunk/src/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp:582
#9  0x0000000000bf4b78 in llvm::SelectionDAGISel::SelectBasicBlock (this=0x1695500, 
    LLVMBB=0x16745d0, Begin=..., End=..., HadTailCall=@0x7fffffffdb9e)
    at /usr/local/google/jyasskin/llvm/trunk/src/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:411
#10 0x0000000000bf5730 in llvm::SelectionDAGISel::SelectAllBasicBlocks (this=0x1695500, 
    Fn=..., MF=..., MMI=0x16869b0, DW=0x169b320, TII=...)
    at /usr/local/google/jyasskin/llvm/trunk/src/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:844
#11 0x0000000000bf6577 in llvm::SelectionDAGISel::runOnMachineFunction (this=0x1695500, 
    mf=...)
    at /usr/local/google/jyasskin/llvm/trunk/src/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:341
#12 0x0000000000d2e421 in llvm::MachineFunctionPass::runOnFunction (this=0x1695500, 
    F=...)
    at /usr/local/google/jyasskin/llvm/trunk/src/lib/CodeGen/MachineFunctionPass.cpp:27
#13 0x0000000000fe2f10 in llvm::FPPassManager::runOnFunction (this=0x16788d0, F=...)
    at /usr/local/google/jyasskin/llvm/trunk/src/lib/VMCore/PassManager.cpp:1336
#14 0x0000000000fe4b8f in llvm::FunctionPassManagerImpl::run (this=0x16782f0, F=...)
    at /usr/local/google/jyasskin/llvm/trunk/src/lib/VMCore/PassManager.cpp:1288
#15 0x0000000000fe4d36 in llvm::FunctionPassManager::run (this=0x1675020, F=...)
    at /usr/local/google/jyasskin/llvm/trunk/src/lib/VMCore/PassManager.cpp:1218
#16 0x0000000000cc8ae1 in llvm::JIT::runJITOnFunctionUnlocked (this=0x16807d0, 
    F=0x16732c0, locked=...)
    at /usr/local/google/jyasskin/llvm/trunk/src/lib/ExecutionEngine/JIT/JIT.cpp:601
#17 0x0000000000cc8f17 in llvm::JIT::getPointerToFunction (this=0x16807d0, F=0x16732c0)
    at /usr/local/google/jyasskin/llvm/trunk/src/lib/ExecutionEngine/JIT/JIT.cpp:667
#18 0x00000000008e6e4c in main (argc=4, argv=0x7fffffffe298, envp=0x7fffffffe2c0)
    at /usr/local/google/jyasskin/llvm/trunk/src/tools/lli/lli.cpp:211


This was introduced in r88984.
Comment 1 Jeffrey Yasskin 2010-01-08 16:24:39 PST
Created attachment 4015 [details]
test/CodeGen/X86/tailcall-largecode.ll

Still crashes at r92972.
Comment 2 Jeffrey Yasskin 2010-01-08 19:39:33 PST
Created attachment 4017 [details]
Fix: changed R9 to R11 in the assert
Comment 3 Jeffrey Yasskin 2010-01-09 13:06:22 PST
Fixed and tested in r93065.