aco: don't consider loop header blocks branch blocks in add_coupling_code
authorRhys Perry <pendingchaos02@gmail.com>
Thu, 2 Jan 2020 14:54:31 +0000 (14:54 +0000)
committerMarge Bot <eric+marge@anholt.net>
Wed, 29 Jan 2020 18:02:27 +0000 (18:02 +0000)
Loops without continues create header blocks with only 1 predecessor.

CC: <mesa-stable@lists.freedesktop.org>
Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3257>

src/amd/compiler/aco_spill.cpp

index e0c3ea955cd4312538d5ae95643b3ffec6932d8e..576b8e02aea60d96a1a17988102b16bf3fd9b3c3 100644 (file)
@@ -665,7 +665,7 @@ void add_coupling_code(spill_ctx& ctx, Block* block, unsigned block_idx)
 
    std::vector<aco_ptr<Instruction>> instructions;
    /* branch block: TODO take other branch into consideration */
-   if (block->linear_preds.size() == 1 && !(block->kind & block_kind_loop_exit)) {
+   if (block->linear_preds.size() == 1 && !(block->kind & (block_kind_loop_exit | block_kind_loop_header))) {
       assert(ctx.processed[block->linear_preds[0]]);
       assert(ctx.register_demand[block_idx].size() == block->instructions.size());
       std::vector<RegisterDemand> reg_demand;