[PATCH] D137813: [RegAlloc Greedy]Account statepoints while splitting single basic block

Quentin Colombet via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 15 09:16:59 PST 2022


qcolombet added a comment.

Hi Serguei,

> In both cases it is expected that enter basic block on stack and exit it on stack as well (if there are liveIn and liveOut respectively).

As you found out, this is definitely not true :).

The reason for split, irrespective of where, is to relax the register constraints. You cannot know at this point whether or not the previous live-range will end-up in stack or not.

E.g.,

  v1 = defA ...
  ...  = useB v1
  ... = call
  ... = useC v1

As it stands, `v1` live-range needs to work with all these contraints:

- What `defA` supports (think encoding constraints)
- What `useB` supports
- What `useC` supports
- What `call` preserves

As you can imagine based on which constraints you need to consider you get an allocatable pool of registers of different sizes. Now, when you add some split points, you relax the constraints on the new live-ranges.
E.g., suppose we split `v1` right after `call`. The new live-range will only be constrained by `useC` and `v1` wouldn't have to comply to `useC`'s constraints either. Maybe that's enough to avoid spill, maybe it's not. We don't know at this point. (Plus you need to consider what is available at each different program point based on what is already allocated.)

To step back a little bit, what are you trying to achieve?

Cheers,
-Quentin


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D137813/new/

https://reviews.llvm.org/D137813



More information about the llvm-commits mailing list