aco: don't CSE v_readlane_b32/v_readfirstlane_b32
authorRhys Perry <pendingchaos02@gmail.com>
Sat, 21 Sep 2019 15:00:45 +0000 (16:00 +0100)
committerRhys Perry <pendingchaos02@gmail.com>
Thu, 26 Sep 2019 12:19:51 +0000 (13:19 +0100)
Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
src/amd/compiler/aco_opt_value_numbering.cpp

index 8071ace1f97449502f5c6f4327cb59adc7d0ced5..100537fd47ad87304da7fbfe0d993bebf9b0168b 100644 (file)
@@ -82,6 +82,10 @@ struct InstrPred {
          return false;
       if (a->operands.size() != b->operands.size() || a->definitions.size() != b->definitions.size())
          return false; /* possible with pseudo-instructions */
+      /* We can't value number v_readlane_b32 across control flow or discards
+       * because of the possibility of live-range splits. */
+      if (a->opcode == aco_opcode::v_readfirstlane_b32 || a->opcode == aco_opcode::v_readlane_b32)
+         return false;
       for (unsigned i = 0; i < a->operands.size(); i++) {
          if (a->operands[i].isConstant()) {
             if (!b->operands[i].isConstant())