r600/sb: handle jump after target to end of program. (v2)
authorDave Airlie <airlied@redhat.com>
Sun, 26 Nov 2017 23:36:39 +0000 (23:36 +0000)
committerDave Airlie <airlied@redhat.com>
Wed, 29 Nov 2017 01:52:53 +0000 (11:52 +1000)
This fixes hangs on cayman with
tests/spec/arb_tessellation_shader/execution/trivial-tess-gs_no-gs-inputs.shader_test

This has a single if/else in it, and when this peephole activated,
it would set the jump target to NULL if there was no instruction
after the final POP. This adds a NOP if we get a jump in this case,
and seems to fix the hangs, so we have a valid target for the ELSE
instruction to go to, instead of 0 (which causes infinite loops).

v2: update last_cf correctly. (I had some other patches hide this)

Cc: <mesa-stable@lists.freedesktop.org>
Signed-off-by: Dave Airlie <airlied@redhat.com>
src/gallium/drivers/r600/sb/sb_bc_finalize.cpp

index 82826a90921eb6ebc9c7eb0408e68a8330366857..7f1dd0a7a0e9f38ca24a79935ff1dd264dfb7b2b 100644 (file)
@@ -933,6 +933,11 @@ void bc_finalizer::cf_peephole() {
                cf_node *c = static_cast<cf_node*>(*I);
 
                if (c->jump_after_target) {
+                       if (c->jump_target->next == NULL) {
+                               c->jump_target->insert_after(sh.create_cf(CF_OP_NOP));
+                               if (last_cf == c->jump_target)
+                                       last_cf = static_cast<cf_node*>(c->jump_target->next);
+                       }
                        c->jump_target = static_cast<cf_node*>(c->jump_target->next);
                        c->jump_after_target = false;
                }