[llvm-commits] [llvm] r62834 - /llvm/trunk/lib/CodeGen/PreAllocSplitting.cpp

Owen Anderson resistor at mac.com
Thu Jan 22 21:58:50 PST 2009


On Jan 22, 2009, at 9:51 PM, Evan Cheng wrote:

>
> On Jan 22, 2009, at 7:28 PM, Owen Anderson wrote:
>
>>
>> +        bool NonRestore = false;
>> +        for (SmallPtrSet<MachineInstr*, 4>::iterator UI =
>> +             VNUseCount[CurrVN].begin(), UE =
>> VNUseCount[CurrVN].end();
>> +             UI != UI; ++UI) {
>
> Does order of iteration matters here? Is this deterministic?

It's deterministic.  It iterates over all uses, sorting them by VN.   
It doesn't do any processing until after all of them have been sorted.

>
>>
>> +          int StoreFrameIndex;
>> +          unsigned StoreVReg = TII->isStoreToStackSlot(*UI,
>> StoreFrameIndex);
>> +          if (StoreVReg != (*LI)->reg || StoreFrameIndex !=
>> FrameIndex) {
>> +            NonRestore = false;
>> +            break;
>> +          }
>> +        }
>> +
>> +        if (NonRestore) continue;
>> +
>> +        for (SmallPtrSet<MachineInstr*, 4>::iterator UI =
>> +             VNUseCount[CurrVN].begin(), UE =
>> VNUseCount[CurrVN].end();
>> +             UI != UI; ++UI) {
>> +          LIs->RemoveMachineInstrFromMaps(*UI);
>> +          (*UI)->eraseFromParent();
>> +        }
>> +
>> +        LIs->RemoveMachineInstrFromMaps(DefMI);
>> +        (*LI)->removeValNo(CurrVN);
>> +        DefMI->eraseFromParent();
>
> This code can use a bit of refactoring as well. :-)

Not sure exactly what you're hinting at, but the two loops can't be  
merged.  We need to know that ALL of the uses are spills (the boolean  
is poorly named, will fix) because we can erase them.

--Owen



More information about the llvm-commits mailing list