[LLVMdev] LiveIntervals invalidates LiveVariables?

Alkis Evlogimenos evlogimenos at gmail.com
Wed Sep 7 09:38:53 PDT 2005


On Wed, 2005-09-07 at 18:24 +0800, 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.

We could potentially remove those VirtRegInfos for the registers we
coalesce. But since after coalescing there are no instructions refering
to those coalesced registers, it is logical that noone will ever query
the liveness of those registers (unless there is a bug somewhere in the
code). But strictly speaking we should remove the VirtRegInfo's for the
coalesced registers. Care to submit a patch?

Thanks,

-- 

Alkis




More information about the llvm-dev mailing list