PHI Elimination problem

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.

Regards

Sachin

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.

Thanks,

Evan