[llvm-dev] Adding BB input/output registers during ISel

Tim Northover via llvm-dev llvm-dev at lists.llvm.org
Wed Jun 1 11:42:14 PDT 2016


Hi Tyler,

On 1 June 2016 at 11:27, Tyler Kenney <tjkenney at us.ibm.com> wrote:
> 1.) Can you provide another example of a BB that would have an unreferenced live-in live-out var without making a function call?

The function call was just there to make sure the block wasn't removed
as dead code. The same issue applies to all basic blocks: any block
control passes through from a definition to a use has to have the vreg
marked as live.

> 2.) What is the problem with having a basic-block that ignores an unreferenced live-in, live out? I am sure that will cause an issue, but I'd like to understand a little better what the issue will be. To put it another way, what would happen if I was somehow able to surgically remove res as a live-in & live-out from the BB calling bar() in your example, but change nothing else?

I'm afraid I don't know specifically what *would* go wrong, but the
malformed data-flow information could confuse any inter-block analysis
that happens after your pass. Register allocation might decide to
reuse (and clobber) the vector register in the unmarked middle block,
for example.

> 3.) Just to make sure I understand, I assume you would say the following has the opposite problem:
>
>  I'd like to add this newly-created big vector value as an input reg for all BBs in the func except the one that contains its LIFETIME_START node, and I'd like to add it as an output reg for all BBs in the func except the one that does not contain its LIFETIME_END node.
>
> That has the problem that I may add the inputs & outputs to BBs that shouldn't have them, right? Again, do you know how this issue would manifest itself?

Extra live-ins and outs are probably less harmful since they just
restrict what's allowed. The big problem with this second scenario is
the same as the first: real uses of this register are unmarked at BB
edges.

> 4.) More generic LLVM question here: is there any sort of convention for distinguishing between live-ins/outs for a func and live-ins/outs for a BB? It seems like most of the time I see those terms they're referring to function live-ins/outs, but not always.

I don't think so. They're basically the same thing just at different levels.

Cheers.

Tim.


More information about the llvm-dev mailing list