Module: Mesa
Branch: main
Commit: 668167aac123755b8b77123287cc7f960931108f
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=668167aac123755b8b77123287cc7f960931108f

Author: Gert Wollny <[email protected]>
Date:   Fri Sep  9 14:00:48 2022 +0200

r600/sfn: VS inputs are effectively SSA

Signed-off-by: Gert Wollny <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18619>

---

 src/gallium/drivers/r600/sfn/sfn_peephole.cpp  | 4 ++--
 src/gallium/drivers/r600/sfn/sfn_shader_vs.cpp | 1 +
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/gallium/drivers/r600/sfn/sfn_peephole.cpp 
b/src/gallium/drivers/r600/sfn/sfn_peephole.cpp
index a364dde1fb0..36d77dffa31 100644
--- a/src/gallium/drivers/r600/sfn/sfn_peephole.cpp
+++ b/src/gallium/drivers/r600/sfn/sfn_peephole.cpp
@@ -162,8 +162,8 @@ void PeepholeVisitor::visit(IfInstr *instr)
    if (src1.as_inline_const() &&
        src1.as_inline_const()->sel() == ALU_SRC_0) {
       auto src0 = pred->src(0).as_register();
-      if (src0 && src0->is_ssa()) {
-         assert(!src0->parents().empty());
+      if (src0 && src0->is_ssa() && !src0->parents().empty()) {
+         assert(src0->parents().size() == 1);
          auto parent = *src0->parents().begin();
 
          ReplaceIfPredicate visitor(pred);
diff --git a/src/gallium/drivers/r600/sfn/sfn_shader_vs.cpp 
b/src/gallium/drivers/r600/sfn/sfn_shader_vs.cpp
index ccd71405a57..06f7822256e 100644
--- a/src/gallium/drivers/r600/sfn/sfn_shader_vs.cpp
+++ b/src/gallium/drivers/r600/sfn/sfn_shader_vs.cpp
@@ -485,6 +485,7 @@ bool VertexShader::load_input(nir_intrinsic_instr *intr)
       for (unsigned i = 0; i < nir_dest_num_components(intr->dest); ++i) {
          auto src = vf.allocate_pinned_register(driver_location + 1, i);
          src->pin_live_range(true);
+         src->set_is_ssa(true);
          if (intr->dest.is_ssa)
             vf.inject_value(intr->dest, i, src);
          else {

Reply via email to