[llvm-commits] [llvm] r90759 - in /llvm/trunk: include/llvm/CodeGen/MachineSSAUpdater.h lib/CodeGen/MachineSSAUpdater.cpp lib/CodeGen/TailDuplication.cpp

Evan Cheng evan.cheng at apple.com
Mon Dec 7 10:08:48 PST 2009


On Dec 7, 2009, at 8:27 AM, Chris Lattner wrote:

> 
> On Dec 7, 2009, at 2:15 AM, Evan Cheng wrote:
> 
>> Author: evancheng
>> Date: Mon Dec  7 04:15:19 2009
>> New Revision: 90759
>> 
>> URL: http://llvm.org/viewvc/llvm-project?rev=90759&view=rev
>> Log:
>> Pre-regalloc tale duplication. Work in progress.
> 
> Hey Evan,
> 
>> @@ -207,6 +207,16 @@
>> 
>> +void MachineSSAUpdater::ReplaceRegWith(unsigned OldReg, unsigned NewReg) {
>> +  MRI->replaceRegWith(OldReg, NewReg);
>> +
>> +  AvailableValsTy &AvailableVals = getAvailableVals(AV);
>> +  for (DenseMap<MachineBasicBlock*, unsigned>::iterator
>> +         I = AvailableVals.begin(), E = AvailableVals.end(); I != E; ++I)
>> +    if (I->second == OldReg)
>> +      I->second = NewReg;
>> +}
> 
> This scan can be *really* expensive: O(size of function).  Would it be better to insert copies and then zap the copies at the end?

I know it's expensive. But I have not identified a solution. AvailableVals is the internal data structure tracking reaching definition. I am not sure what you mean by inserting copies. This function is called when it recognize the "cookie" phi instruction is not needed.

Right now the pre-regalloc tail duplication pass is totally useless anyway. It's severely pessmizing code. All the new PHI instructions and copies are not being zapped.

Evan

> 
> -Chris





More information about the llvm-commits mailing list