[LLVMdev] What does this error mean: psuedo instructions should be removed before code emission?

Yuri yuri at rawbw.com
Fri Aug 27 11:32:07 PDT 2010


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



More information about the llvm-dev mailing list