nir/lower_goto_if: Add a route::outside set
[mesa.git] / src / compiler / nir / nir_loop_analyze.h
index b7f862e8c0459a40389c27d7b8a062fc4a22bcec..7b4ed66ee58f2c816fa7c71cee3a646471963b5c 100644 (file)
@@ -21,7 +21,8 @@
  * IN THE SOFTWARE.
  */
 
-#pragma once
+#ifndef NIR_LOOP_ANALYZE_H
+#define NIR_LOOP_ANALYZE_H
 
 #include "nir.h"
 
@@ -90,3 +91,16 @@ nir_is_trivial_loop_if(nir_if *nif, nir_block *break_block)
 
    return true;
 }
+
+static inline bool
+nir_block_ends_in_break(nir_block *block)
+{
+   if (exec_list_is_empty(&block->instr_list))
+      return false;
+
+   nir_instr *instr = nir_block_last_instr(block);
+   return instr->type == nir_instr_type_jump &&
+      nir_instr_as_jump(instr)->type == nir_jump_break;
+}
+
+#endif /* NIR_LOOP_ANALYZE_H */