mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 11:48:06 +02:00
intel/brw: Pull dead_code_eliminate out of fs_visitor
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com> Reviewed-by: Ian Romanick <ian.d.romanick@intel.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26887>
This commit is contained in:
parent
1bd175f458
commit
59bff8adf4
3 changed files with 14 additions and 12 deletions
|
|
@ -5668,7 +5668,7 @@ fs_visitor::optimize()
|
|||
* encountered. Wipe those away before algebraic optimizations and
|
||||
* especially copy propagation can mix things up.
|
||||
*/
|
||||
OPT(dead_code_eliminate);
|
||||
OPT(brw_fs_opt_dead_code_eliminate, *this);
|
||||
|
||||
OPT(remove_extra_rounding_modes);
|
||||
|
||||
|
|
@ -5682,7 +5682,7 @@ fs_visitor::optimize()
|
|||
OPT(brw_fs_opt_copy_propagation, *this);
|
||||
OPT(opt_predicated_break, this);
|
||||
OPT(brw_fs_opt_cmod_propagation, *this);
|
||||
OPT(dead_code_eliminate);
|
||||
OPT(brw_fs_opt_dead_code_eliminate, *this);
|
||||
OPT(opt_peephole_sel);
|
||||
OPT(dead_control_flow_eliminate, this);
|
||||
OPT(brw_fs_opt_saturate_propagation, *this);
|
||||
|
|
@ -5697,7 +5697,7 @@ fs_visitor::optimize()
|
|||
|
||||
if (OPT(lower_pack)) {
|
||||
OPT(register_coalesce);
|
||||
OPT(dead_code_eliminate);
|
||||
OPT(brw_fs_opt_dead_code_eliminate, *this);
|
||||
}
|
||||
|
||||
OPT(lower_simd_width);
|
||||
|
|
@ -5729,7 +5729,7 @@ fs_visitor::optimize()
|
|||
*/
|
||||
OPT(opt_cse);
|
||||
OPT(register_coalesce);
|
||||
OPT(dead_code_eliminate);
|
||||
OPT(brw_fs_opt_dead_code_eliminate, *this);
|
||||
OPT(opt_peephole_sel);
|
||||
}
|
||||
|
||||
|
|
@ -5744,7 +5744,7 @@ fs_visitor::optimize()
|
|||
|
||||
OPT(register_coalesce);
|
||||
OPT(lower_simd_width);
|
||||
OPT(dead_code_eliminate);
|
||||
OPT(brw_fs_opt_dead_code_eliminate, *this);
|
||||
}
|
||||
|
||||
OPT(opt_combine_constants);
|
||||
|
|
@ -5763,7 +5763,7 @@ fs_visitor::optimize()
|
|||
if (progress) {
|
||||
if (OPT(brw_fs_opt_copy_propagation, *this))
|
||||
OPT(opt_algebraic);
|
||||
OPT(dead_code_eliminate);
|
||||
OPT(brw_fs_opt_dead_code_eliminate, *this);
|
||||
OPT(lower_simd_width);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -276,7 +276,6 @@ public:
|
|||
bool opt_split_sends();
|
||||
bool register_coalesce();
|
||||
bool eliminate_find_live_channel();
|
||||
bool dead_code_eliminate();
|
||||
bool remove_extra_rounding_modes();
|
||||
|
||||
fs_instruction_scheduler *prepare_scheduler(void *mem_ctx);
|
||||
|
|
@ -625,6 +624,7 @@ void nir_to_brw(fs_visitor *s);
|
|||
|
||||
bool brw_fs_opt_cmod_propagation(fs_visitor &s);
|
||||
bool brw_fs_opt_copy_propagation(fs_visitor &s);
|
||||
bool brw_fs_opt_dead_code_eliminate(fs_visitor &s);
|
||||
bool brw_fs_opt_saturate_propagation(fs_visitor &s);
|
||||
|
||||
#endif /* BRW_FS_H */
|
||||
|
|
|
|||
|
|
@ -73,16 +73,18 @@ can_omit_write(const fs_inst *inst)
|
|||
}
|
||||
|
||||
bool
|
||||
fs_visitor::dead_code_eliminate()
|
||||
brw_fs_opt_dead_code_eliminate(fs_visitor &s)
|
||||
{
|
||||
const intel_device_info *devinfo = s.devinfo;
|
||||
|
||||
bool progress = false;
|
||||
|
||||
const fs_live_variables &live_vars = live_analysis.require();
|
||||
const fs_live_variables &live_vars = s.live_analysis.require();
|
||||
int num_vars = live_vars.num_vars;
|
||||
BITSET_WORD *live = rzalloc_array(NULL, BITSET_WORD, BITSET_WORDS(num_vars));
|
||||
BITSET_WORD *flag_live = rzalloc_array(NULL, BITSET_WORD, 1);
|
||||
|
||||
foreach_block_reverse_safe(block, cfg) {
|
||||
foreach_block_reverse_safe(block, s.cfg) {
|
||||
memcpy(live, live_vars.block_data[block->num].liveout,
|
||||
sizeof(BITSET_WORD) * BITSET_WORDS(num_vars));
|
||||
memcpy(flag_live, live_vars.block_data[block->num].flag_liveout,
|
||||
|
|
@ -140,13 +142,13 @@ fs_visitor::dead_code_eliminate()
|
|||
}
|
||||
}
|
||||
|
||||
cfg->adjust_block_ips();
|
||||
s.cfg->adjust_block_ips();
|
||||
|
||||
ralloc_free(live);
|
||||
ralloc_free(flag_live);
|
||||
|
||||
if (progress)
|
||||
invalidate_analysis(DEPENDENCY_INSTRUCTIONS);
|
||||
s.invalidate_analysis(DEPENDENCY_INSTRUCTIONS);
|
||||
|
||||
return progress;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue