Dale Johannesen
2010-Aug-27 18:05 UTC
[LLVMdev] What does this error mean: psuedo instructions should be removed before code emission?
On Aug 27, 2010, at 11:00 AMPDT, Eric Christopher wrote:>>> >>> For some reason I am getting this error even when I only have an >>> empty 'main' function. So I couldn't create .ll file reproducing >>> it and I have to debug myself. >>> >>> The function causing the problem is stub created in >>> JIT::runFunction: Function *Stub = Function::Create(STy, >>> Function::InternalLinkage, "" ... >>> >>> Here is the log of machine instructions before and after >>> emitEpilogue for this function: >>> * PEI::insertPrologEpilogCode: === >> before emitEpilogue >>> - insn: PUSH64r %RBP<kill>, %RSP<imp-def>, %RSP<imp-use> >>> - insn: PROLOG_LABEL <MCSym=.Ltmp2> >>> - insn: %RBP<def> = MOV64rr %RSP >>> - insn: PROLOG_LABEL <MCSym=.Ltmp3> >>> - insn: %RDI<def> = MOV64ri64i32 60910096 >>> - insn: %RAX<def> = MOV64ri >>> <ga:@_ZN010HelloWorld4mainEPN13ContainerSVecE> >>> - insn: TCRETURNri64 %RAX<kill>, 0, %RDI<kill>, %RAX<imp- >>> def,dead>, %RDI<imp-def,dead>, %RSP<imp-use>, ... >>> - insn: RET >>> * PEI::insertPrologEpilogCode: === << before emitEpilogue >>> >>> Function only has on BB. Is this wrong that it has both >>> TCRETURNri64 and RET in one BB? >> >> Yes, that is wrong. The reason emitEpilogue isn't lowering the >> TCRETURN is that it doesn't see it, it only sees the RET. The >> real problem will be where that RET is generated. Normally that's >> LowerCall (where it is spelled TC_RETURN), but reading through it I >> can't see any way to generate both a TC_RETURN and a RET. >> > Bug somewhere for sure, but without a testcase or way to reproduce > it then it'd be hard to find.Yes, Yuri's going to have to debug it, or provide a way for others to reproduce it. It could be his host compiler is miscompiling llvm, too.
Yuri
2010-Aug-27 18:24 UTC
[LLVMdev] What does this error mean: psuedo instructions should be removed before code emission?
On 08/27/2010 11:05, Dale Johannesen wrote:>>>> Function only has on BB. Is this wrong that it has both >>>> TCRETURNri64 and RET in one BB? >>> >>> Yes, that is wrong. The reason emitEpilogue isn't lowering the >>> TCRETURN is that it doesn't see it, it only sees the RET. The real >>> problem will be where that RET is generated. Normally that's >>> LowerCall (where it is spelled TC_RETURN), but reading through it I >>> can't see any way to generate both a TC_RETURN and a RET. >>> >> Bug somewhere for sure, but without a testcase or way to reproduce it >> then it'd be hard to find. > > Yes, Yuri's going to have to debug it, or provide a way for others to > reproduce it. > > It could be his host compiler is miscompiling llvm, too. >I am debugging it. I use gcc-4.5.0 that I built myself to compile llvm. Yuri
Yuri
2010-Aug-27 18:32 UTC
[LLVMdev] What does this error mean: psuedo instructions should be removed before code emission?
On 08/27/2010 11:05, Dale Johannesen wrote:>>>> Function only has on BB. Is this wrong that it has both >>>> TCRETURNri64 and RET in one BB? >>> >>> Yes, that is wrong. The reason emitEpilogue isn't lowering the >>> TCRETURN is that it doesn't see it, it only sees the RET. The real >>> problem will be where that RET is generated. Normally that's >>> LowerCall (where it is spelled TC_RETURN), but reading through it I >>> can't see any way to generate both a TC_RETURN and a RET. >>> >> Bug somewhere for sure, but without a testcase or way to reproduce it >> then it'd be hard to find. > > > Yes, Yuri's going to have to debug it, or provide a way for others to > reproduce it. > > It could be his host compiler is miscompiling llvm, too. >As I understand only one of TCRETURNri64 and RET should be created. I have sources of rev.112200. Here is the stack when TCRETURNri64 instruction is created: #1 0x0000000802c8b4e2 in llvm::MachineFunction::CreateMachineInstr (this=0x30eb000, TID=@0x803a78940, DL={LineCol = 0, ScopeIdx = 0}, NoImp=false) at /tmp/llvm-svn/llvm/lib/CodeGen/MachineFunction.cpp:153 #2 0x00000008028ea45b in llvm::BuildMI (BB=@0x4b69378, I={<std::iterator<std::bidirectional_iterator_tag, llvm::MachineInstr, long int, llvm::MachineInstr*, llvm::MachineInstr&>> = {<No data fields>}, NodePtr = 0x4b69440}, DL={LineCol = 0, ScopeIdx = 0}, TID=@0x803a78940) at MachineInstrBuilder.h:183 #3 0x0000000803451825 in llvm::X86RegisterInfo::emitPrologue (this=0x1a96220, MF=@0x30eb000) at /tmp/llvm-svn/llvm/lib/Target/X86/X86RegisterInfo.cpp:1037 #4 0x0000000802cdf3e5 in llvm::PEI::insertPrologEpilogCode (this=0x3231900, Fn=@0x30eb000) at /tmp/llvm-svn/llvm/lib/CodeGen/PrologEpilogInserter.cpp:680 #5 0x0000000802cdcf04 in llvm::PEI::runOnMachineFunction (this=0x3231900, Fn=@0x30eb000) at /tmp/llvm-svn/llvm/lib/CodeGen/PrologEpilogInserter.cpp:106 #6 0x0000000802c92abd in llvm::MachineFunctionPass::runOnFunction (this=0x3231900, F=@0x4530c60) at /tmp/llvm-svn/llvm/lib/CodeGen/MachineFunctionPass.cpp:33 #7 0x0000000802e76e77 in llvm::FPPassManager::runOnFunction (this=0x235e540, F=@0x4530c60) at /tmp/llvm-svn/llvm/lib/VMCore/PassManager.cpp:1443 #8 0x0000000802e76b3f in llvm::FunctionPassManagerImpl::run (this=0x1e1a300, F=@0x4530c60) at /tmp/llvm-svn/llvm/lib/VMCore/PassManager.cpp:1394 #9 0x0000000802e767ef in llvm::FunctionPassManager::run (this=0x4b566c0, F=@0x4530c60) at /tmp/llvm-svn/llvm/lib/VMCore/PassManager.cpp:1324 #10 0x0000000802f50500 in llvm::JIT::jitTheFunction (this=0x327a7e0, F=0x4530c60, locked=@0x7fffffff9840) at /tmp/llvm-svn/llvm/lib/ExecutionEngine/JIT/JIT.cpp:655 #11 0x0000000802f5037b in llvm::JIT::runJITOnFunctionUnlocked (this=0x327a7e0, F=0x4530c60, locked=@0x7fffffff9840) at /tmp/llvm-svn/llvm/lib/ExecutionEngine/JIT/JIT.cpp:633 #12 0x0000000802f507e4 in llvm::JIT::getPointerToFunction (this=0x327a7e0, F=0x4530c60) at /tmp/llvm-svn/llvm/lib/ExecutionEngine/JIT/JIT.cpp:719 Here is the stack when RET instruction is created: #1 0x0000000802c8b4e2 in llvm::MachineFunction::CreateMachineInstr (this=0x30eb000, TID=@0x803a99240, DL={LineCol = 0, ScopeIdx = 0}, NoImp=false) at /tmp/llvm-svn/llvm/lib/CodeGen/MachineFunction.cpp:153 #2 0x00000008028ea45b in llvm::BuildMI (BB=@0x4b69378, I={<std::iterator<std::bidirectional_iterator_tag, llvm::MachineInstr, long int, llvm::MachineInstr*, llvm::MachineInstr&>> = {<No data fields>}, NodePtr = 0x4b69388}, DL={LineCol = 0, ScopeIdx = 0}, TID=@0x803a99240) at MachineInstrBuilder.h:183 #3 0x00000008033c7637 in X86SelectRet (this=0x4530bd0, I=0x493fae0) at /tmp/llvm-svn/llvm/lib/Target/X86/X86FastISel.cpp:771 #4 0x00000008033cc4fc in TargetSelectInstruction (this=0x4530bd0, I=0x493fae0) at /tmp/llvm-svn/llvm/lib/Target/X86/X86FastISel.cpp:1783 #5 0x000000080315a64f in llvm::FastISel::SelectInstruction (this=0x4530bd0, I=0x493fae0) at /tmp/llvm-svn/llvm/lib/CodeGen/SelectionDAG/FastISel.cpp:706 #6 0x0000000803275ee0 in llvm::SelectionDAGISel::SelectAllBasicBlocks (this=0x45174d0, Fn=@0x4530c60) at /tmp/llvm-svn/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:726 #7 0x00000008032737f7 in llvm::SelectionDAGISel::runOnMachineFunction (this=0x45174d0, mf=@0x30eb000) at /tmp/llvm-svn/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:252 #8 0x0000000802c92abd in llvm::MachineFunctionPass::runOnFunction (this=0x45174d0, F=@0x4530c60) at /tmp/llvm-svn/llvm/lib/CodeGen/MachineFunctionPass.cpp:33 #9 0x0000000802e76e77 in llvm::FPPassManager::runOnFunction (this=0x235e540, F=@0x4530c60) at /tmp/llvm-svn/llvm/lib/VMCore/PassManager.cpp:1443 #10 0x0000000802e76b3f in llvm::FunctionPassManagerImpl::run (this=0x1e1a300, F=@0x4530c60) at /tmp/llvm-svn/llvm/lib/VMCore/PassManager.cpp:1394 #11 0x0000000802e767ef in llvm::FunctionPassManager::run (this=0x4b566c0, F=@0x4530c60) at /tmp/llvm-svn/llvm/lib/VMCore/PassManager.cpp:1324 #12 0x0000000802f50500 in llvm::JIT::jitTheFunction (this=0x327a7e0, F=0x4530c60, locked=@0x7fffffff9840) at /tmp/llvm-svn/llvm/lib/ExecutionEngine/JIT/JIT.cpp:655 #13 0x0000000802f5037b in llvm::JIT::runJITOnFunctionUnlocked (this=0x327a7e0, F=0x4530c60, locked=@0x7fffffff9840) at /tmp/llvm-svn/llvm/lib/ExecutionEngine/JIT/JIT.cpp:633 #14 0x0000000802f507e4 in llvm::JIT::getPointerToFunction (this=0x327a7e0, F=0x4530c60) at /tmp/llvm-svn/llvm/lib/ExecutionEngine/JIT/JIT.cpp:719 ....my code..... Yuri
Yuri
2010-Aug-27 18:53 UTC
[LLVMdev] What does this error mean: psuedo instructions should be removed before code emission?
On 08/27/2010 11:32, Yuri wrote:> As I understand only one of TCRETURNri64 and RET should be created. > I have sources of rev.112200. > > Here is the stack when TCRETURNri64 instruction is created: > #1 0x0000000802c8b4e2 in llvm::MachineFunction::CreateMachineInstr > (this=0x30eb000, TID=@0x803a78940, DL={LineCol = 0, ScopeIdx = 0}, > NoImp=false) at /tmp/llvm-svn/llvm/lib/CodeGen/MachineFunction.cpp:153 > #2 0x00000008028ea45b in llvm::BuildMI (BB=@0x4b69378, > I={<std::iterator<std::bidirectional_iterator_tag, llvm::MachineInstr, > long int, llvm::MachineInstr*, llvm::MachineInstr&>> = {<No data > fields>}, NodePtr = 0x4b69440}, DL={LineCol = 0, ScopeIdx = 0}, > TID=@0x803a78940) at MachineInstrBuilder.h:183 > #3 0x0000000803451825 in llvm::X86RegisterInfo::emitPrologue > (this=0x1a96220, MF=@0x30eb000) at > /tmp/llvm-svn/llvm/lib/Target/X86/X86RegisterInfo.cpp:1037 > #4 0x0000000802cdf3e5 in llvm::PEI::insertPrologEpilogCode > (this=0x3231900, Fn=@0x30eb000) at > /tmp/llvm-svn/llvm/lib/CodeGen/PrologEpilogInserter.cpp:680 > #5 0x0000000802cdcf04 in llvm::PEI::runOnMachineFunction > (this=0x3231900, Fn=@0x30eb000) at > /tmp/llvm-svn/llvm/lib/CodeGen/PrologEpilogInserter.cpp:106 > #6 0x0000000802c92abd in llvm::MachineFunctionPass::runOnFunction > (this=0x3231900, F=@0x4530c60) at > /tmp/llvm-svn/llvm/lib/CodeGen/MachineFunctionPass.cpp:33 > #7 0x0000000802e76e77 in llvm::FPPassManager::runOnFunction > (this=0x235e540, F=@0x4530c60) at > /tmp/llvm-svn/llvm/lib/VMCore/PassManager.cpp:1443 > #8 0x0000000802e76b3f in llvm::FunctionPassManagerImpl::run > (this=0x1e1a300, F=@0x4530c60) at > /tmp/llvm-svn/llvm/lib/VMCore/PassManager.cpp:1394 > #9 0x0000000802e767ef in llvm::FunctionPassManager::run > (this=0x4b566c0, F=@0x4530c60) at > /tmp/llvm-svn/llvm/lib/VMCore/PassManager.cpp:1324 > #10 0x0000000802f50500 in llvm::JIT::jitTheFunction (this=0x327a7e0, > F=0x4530c60, locked=@0x7fffffff9840) at > /tmp/llvm-svn/llvm/lib/ExecutionEngine/JIT/JIT.cpp:655 > #11 0x0000000802f5037b in llvm::JIT::runJITOnFunctionUnlocked > (this=0x327a7e0, F=0x4530c60, locked=@0x7fffffff9840) at > /tmp/llvm-svn/llvm/lib/ExecutionEngine/JIT/JIT.cpp:633 > #12 0x0000000802f507e4 in llvm::JIT::getPointerToFunction > (this=0x327a7e0, F=0x4530c60) at > /tmp/llvm-svn/llvm/lib/ExecutionEngine/JIT/JIT.cpp:719 > > > Here is the stack when RET instruction is created: > #1 0x0000000802c8b4e2 in llvm::MachineFunction::CreateMachineInstr > (this=0x30eb000, TID=@0x803a99240, DL={LineCol = 0, ScopeIdx = 0}, > NoImp=false) at /tmp/llvm-svn/llvm/lib/CodeGen/MachineFunction.cpp:153 > #2 0x00000008028ea45b in llvm::BuildMI (BB=@0x4b69378, > I={<std::iterator<std::bidirectional_iterator_tag, llvm::MachineInstr, > long int, llvm::MachineInstr*, llvm::MachineInstr&>> = {<No data > fields>}, NodePtr = 0x4b69388}, DL={LineCol = 0, ScopeIdx = 0}, > TID=@0x803a99240) at MachineInstrBuilder.h:183 > #3 0x00000008033c7637 in X86SelectRet (this=0x4530bd0, I=0x493fae0) at > /tmp/llvm-svn/llvm/lib/Target/X86/X86FastISel.cpp:771 > #4 0x00000008033cc4fc in TargetSelectInstruction (this=0x4530bd0, > I=0x493fae0) at /tmp/llvm-svn/llvm/lib/Target/X86/X86FastISel.cpp:1783 > #5 0x000000080315a64f in llvm::FastISel::SelectInstruction > (this=0x4530bd0, I=0x493fae0) at > /tmp/llvm-svn/llvm/lib/CodeGen/SelectionDAG/FastISel.cpp:706 > #6 0x0000000803275ee0 in llvm::SelectionDAGISel::SelectAllBasicBlocks > (this=0x45174d0, Fn=@0x4530c60) at > /tmp/llvm-svn/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:726 > #7 0x00000008032737f7 in llvm::SelectionDAGISel::runOnMachineFunction > (this=0x45174d0, mf=@0x30eb000) at > /tmp/llvm-svn/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:252 > #8 0x0000000802c92abd in llvm::MachineFunctionPass::runOnFunction > (this=0x45174d0, F=@0x4530c60) at > /tmp/llvm-svn/llvm/lib/CodeGen/MachineFunctionPass.cpp:33 > #9 0x0000000802e76e77 in llvm::FPPassManager::runOnFunction > (this=0x235e540, F=@0x4530c60) at > /tmp/llvm-svn/llvm/lib/VMCore/PassManager.cpp:1443 > #10 0x0000000802e76b3f in llvm::FunctionPassManagerImpl::run > (this=0x1e1a300, F=@0x4530c60) at > /tmp/llvm-svn/llvm/lib/VMCore/PassManager.cpp:1394 > #11 0x0000000802e767ef in llvm::FunctionPassManager::run > (this=0x4b566c0, F=@0x4530c60) at > /tmp/llvm-svn/llvm/lib/VMCore/PassManager.cpp:1324 > #12 0x0000000802f50500 in llvm::JIT::jitTheFunction (this=0x327a7e0, > F=0x4530c60, locked=@0x7fffffff9840) at > /tmp/llvm-svn/llvm/lib/ExecutionEngine/JIT/JIT.cpp:655 > #13 0x0000000802f5037b in llvm::JIT::runJITOnFunctionUnlocked > (this=0x327a7e0, F=0x4530c60, locked=@0x7fffffff9840) at > /tmp/llvm-svn/llvm/lib/ExecutionEngine/JIT/JIT.cpp:633 > #14 0x0000000802f507e4 in llvm::JIT::getPointerToFunction > (this=0x327a7e0, F=0x4530c60) at > /tmp/llvm-svn/llvm/lib/ExecutionEngine/JIT/JIT.cpp:719 > ....my code....It seems wrong that TCRETURNri64 is created in X86RegisterInfo::emitPrologue even when RET instruction is already there. This seems to be a bug. Yuri
Apparently Analagous Threads
- [LLVMdev] What does this error mean: psuedo instructions should be removed before code emission?
- [LLVMdev] What does this error mean: psuedo instructions should be removed before code emission?
- [LLVMdev] What does this error mean: psuedo instructions should be removed before code emission?
- [LLVMdev] What does this error mean: psuedo instructions should be removed before code emission?
- [LLVMdev] What does this error mean: psuedo instructions should be removed before code emission?