diff options
author | Timothy Arceri <[email protected]> | 2018-06-01 15:37:27 +1000 |
---|---|---|
committer | Timothy Arceri <[email protected]> | 2018-06-07 11:33:04 +1000 |
commit | 1098bc5e854a1253e050fa30d16eda6ca676d4b3 (patch) | |
tree | 199e0c8de2e0e279584f7d44626c68615a61bd8f /src/compiler/nir/nir_loop_analyze.h | |
parent | 186988e28f9fe31ad4d08626586d5167051a14e7 (diff) |
nir: move ends_in_break() helper to nir_loop_analyze.h
We will use the helper while simplifying potential loop terminators
in the following patch.
Reviewed-by: Ian Romanick <[email protected]>
Diffstat (limited to 'src/compiler/nir/nir_loop_analyze.h')
-rw-r--r-- | src/compiler/nir/nir_loop_analyze.h | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/compiler/nir/nir_loop_analyze.h b/src/compiler/nir/nir_loop_analyze.h index 18c23051717..7b4ed66ee58 100644 --- a/src/compiler/nir/nir_loop_analyze.h +++ b/src/compiler/nir/nir_loop_analyze.h @@ -92,4 +92,15 @@ 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 */ |