[LLVMdev] Asserts in bundleWithPred() and bundleWithSucc()

Jakob Stoklund Olesen stoklund at 2pi.dk
Mon Feb 4 16:08:43 PST 2013


On Feb 4, 2013, at 3:44 PM, "Sergei Larin" <slarin at codeaurora.org> wrote:

>  Seems like an easy solution for this case... But let me ask you a more
> general question.
> The reason I kept on hanging on to the MBB->splice was (probably outdated)
> assumption that it will one day properly update liveness for instructions it
> moves... That is a serious matter for what I am trying to do (global code
> motion in presence of bundles).
> 
>  What is the current thinking? Will we ever be able to move an instruction
> between BBs and have liveness updated properly? If so, what interface will
> we need for that? Based on your answer, original question might become a bit
> more easy to answer.

Good question.

We currently have handleMove() which will update liveness after moving a single instruction within a basic block. I could see it being extended to handle globally moved instructions as well.

I am wary of an API that automatically updates liveness because it can be expensive to maintain valid liveness along a number of intermediate steps, compared to recomputing liveness in batch after multiple changes. 

Consider hoisting chained instructions out of a loop one at a time. The live ranges of the intermediate steps look completely different from the final result.

So for a future automatic liveness API, I imagine something like:

  LIS.beginChanges();
  ..
  Move multiple instructions around.
  ..
  LIS.endChanges();

[Or it could use RAII, that's not important]

MachineFunction would provide observer hooks that LIS can use to collect a set of changed instructions. The call to LIS.endChanges() would then recompute the invalid live ranges.

/jakob




More information about the llvm-dev mailing list