From dfd5341d7117e4299b6c34e8b1feb0e66c230478 Mon Sep 17 00:00:00 2001
From: ReinUsesLisp <reinuseslisp@airmail.cc>
Date: Sun, 11 Apr 2021 20:40:00 -0300
Subject: shader: Mark blocks with no end branch as unreachable

---
 .../frontend/maxwell/structured_control_flow.cpp                 | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

(limited to 'src/shader_recompiler/frontend/maxwell/structured_control_flow.cpp')

diff --git a/src/shader_recompiler/frontend/maxwell/structured_control_flow.cpp b/src/shader_recompiler/frontend/maxwell/structured_control_flow.cpp
index 02cef26455..e63e25aa65 100644
--- a/src/shader_recompiler/frontend/maxwell/structured_control_flow.cpp
+++ b/src/shader_recompiler/frontend/maxwell/structured_control_flow.cpp
@@ -816,8 +816,13 @@ private:
                 throw NotImplementedException("Statement type {}", stmt.type);
             }
         }
-        if (current_block && continue_block) {
-            IR::IREmitter{*current_block}.Branch(continue_block);
+        if (current_block) {
+            IR::IREmitter ir{*current_block};
+            if (continue_block) {
+                ir.Branch(continue_block);
+            } else {
+                ir.Unreachable();
+            }
         }
     }
 
-- 
cgit v1.2.3-70-g09d2