OSDN Git Service

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)
committerDylan Baker <dylan@pnwbakers.com>
Mon, 3 Feb 2020 16:31:30 +0000 (08:31 -0800)
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>
(cherry picked from commit 521525fc0a3b9008e70841542ad6e3db4b1ea4d6)

.pick_status.json
src/amd/compiler/aco_spill.cpp

index a503d49..403cccc 100644 (file)
         "description": "aco: don't consider loop header blocks branch blocks in add_coupling_code",
         "nominated": true,
         "nomination_type": 0,
-        "resolution": 0,
+        "resolution": 1,
         "master_sha": null,
         "because_sha": null
     },
index 952094f..cc662e9 100644 (file)
@@ -659,7 +659,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;