[llvm-commits] [llvm] r45815 - /llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp

Chris Lattner clattner at apple.com
Wed Jan 9 20:08:13 PST 2008


> URL: http://llvm.org/viewvc/llvm-project?rev=45815&view=rev
> Log:
> Don't use LiveVariables::VarInfo::DefInst.

Cool, question though:

> +++ llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp Wed Jan  9  
> 21:12:54 2008
> @@ -309,7 +309,14 @@
>       // are actually two values in the live interval.  Because of  
> this we
>       // need to take the LiveRegion that defines this register and  
> split it
>       // into two values.
> -      unsigned DefIndex =  
> getDefIndex(getInstructionIndex(vi.DefInst));

In the old code, when it introduces multiple definitions of a vreg,  
did it clear DefInst?  If so, this code can only be triggered for  
vregs with a single def.

>
> +      MachineRegisterInfo& MRI = mbb->getParent()->getRegInfo();

I think that MRI should become and ivar in liveintervalanalysis.

>
> +      unsigned lowIndex = ~0U;
> +      for (MachineRegisterInfo::def_iterator DI =  
> MRI.def_begin(interval.reg),
> +          DE = MRI.def_end(); DI != DE; ++DI)
> +        if (getInstructionIndex(&*DI) < lowIndex)
> +          lowIndex = getInstructionIndex(&*DI);
> +
> +      unsigned DefIndex = getDefIndex(lowIndex);

It would be really nice if you could drop the loop.  It's unclear why  
it's right anyway, the numbering is not necessarily contiguous across  
code...

-Chris




More information about the llvm-commits mailing list