[LLVMbugs] [Bug 2223] New: llc fails on tailcall to function pointer

bugzilla-daemon at cs.uiuc.edu bugzilla-daemon at cs.uiuc.edu
Mon Apr 14 02:31:07 PDT 2008


http://llvm.org/bugs/show_bug.cgi?id=2223

           Summary: llc fails on tailcall to function pointer
           Product: tools
           Version: 2.2
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: llc
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: fvbommel at wxs.nl
                CC: llvmbugs at cs.uiuc.edu


On my x86_64 linux box, running "llc -tailcallopt" on the following code
generates an assertion failure:
=====
$ llvm-dis -o - llc-tailcallopt-bug.bc
; ModuleID = 'llc-tailcallopt-bug.bc'

define fastcc i64 @call(i64 ()*) {
entry:
        %ptrcall = tail call fastcc i64 %0( )           ; <i64> [#uses=1]
        ret i64 %ptrcall
}
=====
$ llc llc-tailcallopt-bug.bc -f -o llc-tailcallopt-bug.s -tailcallopt
llc: X86ISelLowering.cpp:1487: llvm::SDOperand
llvm::X86TargetLowering::LowerCALL(llvm::SDOperand, llvm::SelectionDAG&):
Assertion `Callee.getOpcode() == ISD::LOAD && "Function destination must be
loaded into virtual register"' failed.
llc((anonymous namespace)::PrintStackTrace()+0x15)[0xae24b5]
llc((anonymous namespace)::SignalHandler(int)+0x216)[0xae2846]
/lib/libc.so.6[0x2ad3bea167d0]
/lib/libc.so.6(gsignal+0x35)[0x2ad3bea16765]
/lib/libc.so.6(abort+0x110)[0x2ad3bea181c0]
/lib/libc.so.6(__assert_fail+0xef)[0x2ad3bea0fc2f]
llc(llvm::X86TargetLowering::LowerCALL(llvm::SDOperand,
llvm::SelectionDAG&)+0x30f0)[0x6ef410]
llc(llvm::X86TargetLowering::LowerOperation(llvm::SDOperand,
llvm::SelectionDAG&)+0x1a1)[0x6fa951]
llc[0x894903]
llc[0x88e75c]
llc[0x8cabed]
llc(llvm::SelectionDAG::Legalize()+0x33)[0x8cb523]
llc(llvm::SelectionDAGISel::CodeGenAndEmitDAG(llvm::SelectionDAG&)+0x74)[0x83a294]
llc(llvm::SelectionDAGISel::SelectBasicBlock(llvm::BasicBlock*,
llvm::MachineFunction&, llvm::FunctionLoweringInfo&)+0x39f)[0x863b7f]
llc(llvm::SelectionDAGISel::runOnFunction(llvm::Function&)+0x292)[0x8669d2]
llc[0x71c8f3]
llc(llvm::FPPassManager::runOnFunction(llvm::Function&)+0x1ef)[0xa8404f]
llc(llvm::FunctionPassManagerImpl::run(llvm::Function&)+0x72)[0xa84522]
llc(llvm::FunctionPassManager::run(llvm::Function&)+0x3e)[0xa8466e]
llc(main+0xc46)[0x4fc066]
/lib/libc.so.6(__libc_start_main+0xf4)[0x2ad3bea02b44]
llc(cos+0xf9)[0x4fa459]
Aborted (core dumped)
=====
$ llc --version
Low Level Virtual Machine (http://llvm.org/):
  llvm version 2.2
  Optimized build with assertions.
=====

>From some further experimentation inspired by the error message (it wants
"getOpcode() == ISD::LOAD") it appears this happens whenever the function
pointer isn't a constant but wasn't explicitly loaded from memory (i.e. besides
when the function pointer was passed as a parameter, it also happens when
obtained from inttoptr, but not when the function called is a global constant).


-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list