[llvm-commits] Fix for MachineSink creating zombie defines

Eli Friedman eli.friedman at gmail.com
Fri Jul 29 13:09:41 PDT 2011


On Fri, Jul 29, 2011 at 12:13 PM, Jan Sjodin <jan_sjodin at yahoo.com> wrote:
>
>
>> -  return FromBB->SplitCriticalEdge(ToBB, this);
>> +  MachineBasicBlock *result = FromBB->SplitCriticalEdge(ToBB, this);
>> +
>> +  // The live-ins from the successor must be copied to the new BB
>> +  // or later sinks may create "zombie" defines.
>> +  if (!ToBB->livein_empty())
>> +    for (MachineBasicBlock::livein_iterator I = ToBB->livein_begin(),
>> +       E = ToBB->livein_end(); I != E; ++I)
>> +      result->addLiveIn(*I);
>> +
>> +  return result;
>> }
>>
>> static bool AvoidsSinking(MachineInstr *MI, MachineRegisterInfo *MRI) {
>>
>> Is there some reason you're putting this into MachineSink.cpp instead
>> of changing MachineBasicBlock::SplitCriticalEdge?
>
> I was unsure if this is desirable for the generic function. Is that the better place for this?

I can't imagine any user of SplitCriticalEdge would not want to
preserve live-ins... and it looks like the other current caller,
MachineLICM, suffers from the same issue.

-Eli




More information about the llvm-commits mailing list