[PATCH] D52052: [RegAllocGreedy] avoid using physreg candidates that cannot be correctly spilled

Daniil Fukalov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 14 10:50:59 PDT 2018


dfukalov marked an inline comment as done.
dfukalov added a comment.

In https://reviews.llvm.org/D52052#1235054, @qcolombet wrote:

> Hi,
>
> Could you elaborate on that part?
>
> > But it is not possible since can generate incorrect code in terms of exec mask.
>
> I don't understand the constraints and thus what you are trying to achieve.
>
> Cheers,
> -Quentin


SplitEditor during splitting region can try to insert COPY spill instruction before S_OR_SAVEEXEC_B64 since it interferes with physreg candidate that is already assigned to destination of this exec mask restoration instruction. Unfortunately, such a COPY operation may be lowered to a memory operation that will not be correct because exec mask is not restored before the preamble.

There was related fix https://reviews.llvm.org/D27997 <https://reviews.llvm.org/D27997> for MachineBasicBlock::SkipPHIsLabelsAndDebug to skip exec masks restore preamble.



================
Comment at: test/CodeGen/AMDGPU/spill-before-exec.mir:6
+# e.g. before exec mask preamble
+# CHECK: , cannot spill all interferences.
+
----------------
rampitec wrote:
> This test will not work in a non-debug build. It needs at least
> 
> ```
> ; REQUIRES: asserts
> ```
thanks!


https://reviews.llvm.org/D52052





More information about the llvm-commits mailing list