[llvm-commits] [llvm] r80654 - in /llvm/trunk: lib/CodeGen/TwoAddressInstructionPass.cpp test/CodeGen/ARM/2009-08-31-TwoRegShuffle.ll

Evan Cheng evan.cheng at apple.com
Tue Sep 1 12:24:50 PDT 2009


On Sep 1, 2009, at 12:00 PM, Bob Wilson wrote:

>
> On Sep 1, 2009, at 11:43 AM, Evan Cheng wrote:
>> Since you have already found the KillMO, there is no need to call  
>> removeVirtualRegisterKilled() which would scan the operands again.  
>> Just update LV varinfo and unset the kill marker.
>
> Oh, I see what you mean.  That makes sense.
>
>> Let's consider a more extensive instead. How about something like  
>> this:
>>
>> 1. Scan an instruction. Look at all the operands. Keep a list of  
>> source registers that are tied to one or more def registers.
>> 2. For each source register, track which def registers it is being  
>> tied to. It should also track the kill operand index.
>> 3. Consider each source register. If it is only tied to one def  
>> register, we can consider performing the usual optimizations. If it  
>> is tied to multiple def, I don't think the current optimizations  
>> are useful.
>> 4. If it is tied to multiple def, process it separately. For each  
>> of the tied def, add a copy (or remat the def). Move the kill  
>> marker to the last copy.
>>
>> This should make the code more understandable.
>
> That sounds like a good approach.  I'll give it a try....

Thanks! Sorry to expand it into a bigger project. But I think this is  
the right way to go.

Evan

>
>>
>>>
>>>>
>>>> Since you are working on this code, could be please clean it up a  
>>>> bit. Can you factor this if statement:
>>>>       if (mi->getOperand(ti).isDead() &&
>>>>           isSafeToDelete(mi, regB, TII, Kills)) {
>>>>
>>>> to a separate function?
>>>
>>> Like this (in the attached patch)?
>>
>> Sorry, I meant factoring out lines 827 to 880 to a separate function.
>
> Ah!  (I knew I must have been missing something there.)  I can  
> certainly take care of that.




More information about the llvm-commits mailing list