[LLVMdev] PHI Elimination problem

Evan Cheng evan.cheng at apple.com
Tue Sep 16 09:42:16 PDT 2008

On Sep 16, 2008, at 2:06 AM, Sachin.Punyani at microchip.com wrote:

> Hi,
> The PHI elimination pass calls the function copyRegToReg for copy  
> placement and then later tries to setkill to the temporary virtual  
> register used in copy placement. For this setkill action it looks  
> only in one instruction (last instruction for copyRegToReg) for  
> virtual register with no use.
> My target has only one register and I can’t do copyRegToReg in one  
> instruction only. So I create two instructions (one:SrcReg to  
> Stack , two:Stack to DestReg). The SrcReg here is the temporary  
> virtual register (for PHI elimination) which should be setkill.  
> However, the PHI Elimination pass looks only in last instruction  
> (here: Stack to DestReg) for any NoUse register and does not find  
> any. Therefore the intended setkill does not take place. This causes  
> an assertion failure saying “PHI elimination vreg should have one  
> kill, the PHI itself”.
> Please provide some input on how this can be solved.

Yes, all places which use copyRegToReg right now assume it creates a  
single MI. If you want to solve this, you need to change its  
interface. There are a couple of options: 1. Change copyRegToReg to  
return by reference a list of instructions, the caller will then be  
responsible for adding them to the MBB. 2. copyRegToReg returns  
iterators which point to start and end of the copy sequence. My  
preference is #1.



> Regards
> Sachin
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20080916/bec6a3ed/attachment.html>

More information about the llvm-dev mailing list