aco: don't add interferences between spilled phi operands
authorDaniel Schürmann <daniel@schuermann.dev>
Wed, 30 Oct 2019 11:32:32 +0000 (12:32 +0100)
committerDaniel Schürmann <daniel@schuermann.dev>
Wed, 30 Oct 2019 19:48:33 +0000 (19:48 +0000)
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
src/amd/compiler/aco_spill.cpp

index 4c7a45ad6df8d310d11943b481618a383896f9fc..6959895d858c211d9f6065b5f44598aeb80202c2 100644 (file)
@@ -797,14 +797,6 @@ void add_coupling_code(spill_ctx& ctx, Block* block, unsigned block_idx)
       std::vector<unsigned> preds = pair.first.type() == RegType::vgpr ? block->logical_preds : block->linear_preds;
 
       for (unsigned pred_idx : preds) {
-         /* add interferences between spilled variable and predecessors exit spills */
-         for (std::pair<Temp, uint32_t> exit_spill : ctx.spills_exit[pred_idx]) {
-            if (exit_spill.first == pair.first)
-               continue;
-            ctx.interferences[exit_spill.second].second.emplace(pair.second);
-            ctx.interferences[pair.second].second.emplace(exit_spill.second);
-         }
-
          /* variable is already spilled at predecessor */
          std::map<Temp, uint32_t>::iterator spilled = ctx.spills_exit[pred_idx].find(pair.first);
          if (spilled != ctx.spills_exit[pred_idx].end()) {
@@ -817,6 +809,14 @@ void add_coupling_code(spill_ctx& ctx, Block* block, unsigned block_idx)
          if (ctx.next_use_distances_end[pred_idx].find(pair.first) == ctx.next_use_distances_end[pred_idx].end())
             continue;
 
+         /* add interferences between spilled variable and predecessors exit spills */
+         for (std::pair<Temp, uint32_t> exit_spill : ctx.spills_exit[pred_idx]) {
+            if (exit_spill.first == pair.first)
+               continue;
+            ctx.interferences[exit_spill.second].second.emplace(pair.second);
+            ctx.interferences[pair.second].second.emplace(exit_spill.second);
+         }
+
          /* variable is in register at predecessor and has to be spilled */
          /* rename if necessary */
          Temp var = pair.first;