aco: remove dead code in handle_operands()
authorRhys Perry <pendingchaos02@gmail.com>
Mon, 23 Mar 2020 20:44:27 +0000 (20:44 +0000)
committerMarge Bot <eric+marge@anholt.net>
Tue, 24 Mar 2020 11:28:55 +0000 (11:28 +0000)
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/4260>

src/amd/compiler/aco_lower_to_hw_instr.cpp

index c555ccdfa85d027ff81d695e31ec215819bafa15..240f6c3a3733268b05ebf2b7744a1a76b4c5da46 100644 (file)
@@ -790,16 +790,13 @@ void handle_operands(std::map<PhysReg, copy_operation>& copy_map, lower_context*
       return;
 
    /* all target regs are needed as operand somewhere which means, all entries are part of a cycle */
-   bool constants = false;
    for (it = copy_map.begin(); it != copy_map.end(); ++it) {
       assert(it->second.op.isFixed());
       if (it->first == it->second.op.physReg())
          continue;
-      /* do constants later */
-      if (it->second.op.isConstant()) {
-         constants = true;
-         continue;
-      }
+
+      /* should already be done */
+      assert(!it->second.op.isConstant());
 
       if (preserve_scc && it->second.def.getTemp().type() == RegType::sgpr)
          assert(!(it->second.def.physReg() == pi->scratch_sgpr));
@@ -846,19 +843,6 @@ void handle_operands(std::map<PhysReg, copy_operation>& copy_map, lower_context*
          }
       }
    }
-
-   /* copy constants into a registers which were operands */
-   if (constants) {
-      for (it = copy_map.begin(); it != copy_map.end(); ++it) {
-         if (!it->second.op.isConstant())
-            continue;
-         if (it->second.def.physReg() == scc) {
-            bld.sopc(aco_opcode::s_cmp_lg_i32, Definition(scc, s1), Operand(0u), Operand(it->second.op.constantValue() ? 1u : 0u));
-         } else {
-            bld.copy(it->second.def, it->second.op);
-         }
-      }
-   }
 }
 
 void lower_to_hw_instr(Program* program)