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

Chris Lattner clattner at apple.com
Mon Dec 7 08:27:03 PST 2009


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?

-Chris



More information about the llvm-commits mailing list