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

Eric Christopher echristo at apple.com
Fri Aug 27 11:00:41 PDT 2010


On Aug 27, 2010, at 10:49 AM, Dale Johannesen wrote:

> 
> On Aug 26, 2010, at 11:34 PMPDT, Yuri wrote:
> 
>> On 08/26/2010 13:17, Dale Johannesen wrote:
>>>>> Insn before the error: TCRETURNri64 %RAX<kill>, 0, %RDI<kill>, %RAX<imp-def,dead>, %RDI<imp-def,dead>, %RSP<imp-use>, ...
>>>> 
>>>> Odd.  I thought TCReturn was being lowered.  At any rate can you file a bug with the .ll file that causes this?
>>> 
>>> It should be getting lowered in emitEpilogue.  Must be a bug somewhere.
>>> 
>> 
>> 
>> 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.

Could have a machine verify pass that makes sure each MBB only had one exit instruction.

-eric



More information about the llvm-dev mailing list