[LLVMdev] LiveIntervals invalidates LiveVariables?

Chris Lattner sabre at nondot.org
Wed Sep 7 10:35:42 PDT 2005

On Wed, 7 Sep 2005, Tzu-Chien Chiu wrote:
> I though LiveVariables may be invalidated by LiveIntervals, but it's
> declared not:
> void LiveIntervals::getAnalysisUsage(AnalysisUsage &AU) const
> {
>  AU.addPreserved<LiveVariables>();
>  AU.addRequired<LiveVariables>();
>  ...
> LiveInterval may coalesce virtual registers and remove identity moves
> instructions:
> bool LiveIntervals::runOnMachineFunction(MachineFunction &fn) {
>  ...
>  // perform a final pass over the instructions and compute spill
>  // weights, coalesce virtual registers and remove identity moves
> but the data structure LiveVariables::VirtRegInfo is _not_ updated.
> That is, VarInfo::DefInstr may point to an invalid (being coalesced)
> instruction.

You're right, that's a bug.  I fixed it here:

That line dates from when live interval analysis didn't do anything fancy. 
In the default code generator, nothing uses livevar after live intervals, 
so this bug didn't cause any problems.



More information about the llvm-dev mailing list