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

Yuri yuri at rawbw.com
Thu Aug 26 23:34:08 PDT 2010


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
* PEI::insertPrologEpilogCode: === >> after 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: %RBP<def> = POP64r %RSP<imp-def>, %RSP<imp-use>
   - insn: RET
* PEI::insertPrologEpilogCode: === << after emitEpilogue

Function only has on BB. Is this wrong that it has both TCRETURNri64 and 
RET in one BB?
You can see that instruction TCRETURNri64 is left by emitEpilogue and 
and this later causes problem in code emitter.
Where in X86RegisterInfo::emitEpilogue TCRETURNri64 is supposed to 
disappear (be lowered)?

Yuri



More information about the llvm-dev mailing list