[PATCH] D121277: [MachineSink] Check block prologue does not clobber uses

Carl Ritson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 9 18:44:57 PST 2022


critson added a comment.

In D121277#3370730 <https://reviews.llvm.org/D121277#3370730>, @MatzeB wrote:

> What do you mean by "block prologue"? Can you tell me which of the 2 `COPY`s in your test is falsely moved with your test and which instruction clobbers the register?
>
> (Intuitively I would expect a live-in value to be available after all PHI instructions so I don't see why there can be a clobber when something is inserted at the beginning of the basic block...)

I have pre-committed the test, so the offending sink should now be obvious.

This occurs because `SkipPHIsAndLabels` skips block prologue instructions as determined by the target, something which is not obvious from the function name.
On AMDGPU the `S_AND_SAVEEXEC_B64` is considered part of the block prologue because it is setting up the correct execution mask for the instructions in the block; however RA has assigned the register `$sgpr4` to the destination of this instruction, effectively clobbering the source of the `COPY` being sunk.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D121277



More information about the llvm-commits mailing list