aco: fix kill flags on phi operands
authorDaniel Schürmann <daniel@schuermann.dev>
Thu, 4 Mar 2021 15:31:22 +0000 (16:31 +0100)
committerMarge Bot <eric+marge@anholt.net>
Tue, 13 Apr 2021 18:40:57 +0000 (18:40 +0000)
Fossil-db changes are likely due to how the CSSA pass works.
Totals from 1782 (1.31% of 136546) affected shaders (Raven):
CodeSize: 25333292 -> 25294020 (-0.16%); split: -0.16%, +0.00%
Instrs: 4916059 -> 4908218 (-0.16%); split: -0.16%, +0.00%
Latency: 282860167 -> 282707176 (-0.05%); split: -0.08%, +0.03%
InvThroughput: 136487564 -> 136394958 (-0.07%); split: -0.12%, +0.05%
VClause: 74791 -> 74795 (+0.01%)
Copies: 542115 -> 534280 (-1.45%); split: -1.48%, +0.04%
Branches: 168977 -> 168966 (-0.01%); split: -0.01%, +0.01%

Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9196>

src/amd/compiler/aco_live_var_analysis.cpp

index 25933bf..6dd8139 100644 (file)
@@ -226,11 +226,13 @@ void process_live_temps_per_block(Program *program, live& lives, Block* block,
          /* check if we changed an already processed block */
          const bool inserted = lives.live_out[preds[i]].insert(operand.tempId()).second;
          if (inserted) {
-            operand.setKill(true);
             worklist.insert(preds[i]);
             if (insn->opcode == aco_opcode::p_phi && operand.getTemp().type() == RegType::sgpr)
                phi_sgpr_ops[preds[i]] += operand.size();
          }
+
+         /* set if the operand is killed by this (or another) phi instruction */
+         operand.setKill(!live.count(operand.tempId()));
       }
       phi_idx--;
    }