brw: Remove dead code from control flow

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33957>
This commit is contained in:
Caio Oliveira 2025-03-07 20:09:26 -08:00 committed by Marge Bot
parent 89f0db0aaa
commit 1744ecc1ce
2 changed files with 0 additions and 138 deletions

View file

@ -77,81 +77,6 @@ bblock_t::add_successor(void *mem_ctx, bblock_t *successor,
children.push_tail(::link(mem_ctx, successor, kind));
}
bool
bblock_t::is_predecessor_of(const bblock_t *block,
enum bblock_link_kind kind) const
{
foreach_list_typed_safe (bblock_link, parent, link, &block->parents) {
if (parent->block == this && parent->kind <= kind) {
return true;
}
}
return false;
}
bool
bblock_t::is_successor_of(const bblock_t *block,
enum bblock_link_kind kind) const
{
foreach_list_typed_safe (bblock_link, child, link, &block->children) {
if (child->block == this && child->kind <= kind) {
return true;
}
}
return false;
}
static bool
ends_block(const brw_inst *inst)
{
enum opcode op = inst->opcode;
return op == BRW_OPCODE_IF ||
op == BRW_OPCODE_ELSE ||
op == BRW_OPCODE_CONTINUE ||
op == BRW_OPCODE_BREAK ||
op == BRW_OPCODE_DO ||
op == BRW_OPCODE_WHILE;
}
static bool
starts_block(const brw_inst *inst)
{
enum opcode op = inst->opcode;
return op == BRW_OPCODE_DO ||
op == BRW_OPCODE_ENDIF;
}
bool
bblock_t::can_combine_with(const bblock_t *that) const
{
if ((const bblock_t *)this->link.next != that)
return false;
if (ends_block(this->end()) ||
starts_block(that->start()))
return false;
return true;
}
void
bblock_t::combine_with(bblock_t *that)
{
assert(this->can_combine_with(that));
foreach_list_typed (bblock_link, link, link, &that->parents) {
assert(link->block == this);
}
this->end_ip = that->end_ip;
this->instructions.append_list(&that->instructions);
this->cfg->remove_block(that);
}
void
bblock_t::dump(FILE *file) const
{
@ -165,28 +90,6 @@ bblock_t::dump(FILE *file) const
}
}
void
bblock_t::unlink_list(exec_list *list)
{
assert(list == &parents || list == &children);
const bool remove_parent = list == &children;
foreach_list_typed_safe(bblock_link, link, link, list) {
/* Also break the links from the other block back to this block. */
exec_list *sub_list = remove_parent ? &link->block->parents : &link->block->children;
foreach_list_typed_safe(bblock_link, sub_link, link, sub_list) {
if (sub_link->block == this) {
sub_link->link.remove();
ralloc_free(sub_link);
}
}
link->link.remove();
ralloc_free(link);
}
}
static void
append_inst(bblock_t *block, brw_inst *inst)
{

View file

@ -79,12 +79,6 @@ struct bblock_t {
void add_successor(void *mem_ctx, bblock_t *successor,
enum bblock_link_kind kind);
bool is_predecessor_of(const bblock_t *block,
enum bblock_link_kind kind) const;
bool is_successor_of(const bblock_t *block,
enum bblock_link_kind kind) const;
bool can_combine_with(const bblock_t *that) const;
void combine_with(bblock_t *that);
void dump(FILE *file = stderr) const;
brw_inst *start();
@ -97,29 +91,10 @@ struct bblock_t {
bblock_t *prev();
const bblock_t *prev() const;
bool starts_with_control_flow() const;
bool ends_with_control_flow() const;
brw_inst *first_non_control_flow_inst();
brw_inst *last_non_control_flow_inst();
private:
/**
* \sa unlink_parents, unlink_children
*/
void unlink_list(exec_list *);
public:
void unlink_parents()
{
unlink_list(&parents);
}
void unlink_children()
{
unlink_list(&children);
}
struct exec_node link;
struct cfg_t *cfg;
@ -197,13 +172,6 @@ bblock_t::prev() const
return (const struct bblock_t *)link.prev;
}
inline bool
bblock_t::starts_with_control_flow() const
{
enum opcode op = start()->opcode;
return op == BRW_OPCODE_DO || op == BRW_OPCODE_ENDIF;
}
inline bool
bblock_t::ends_with_control_flow() const
{
@ -216,15 +184,6 @@ bblock_t::ends_with_control_flow() const
op == SHADER_OPCODE_FLOW;
}
inline brw_inst *
bblock_t::first_non_control_flow_inst()
{
brw_inst *inst = start();
if (starts_with_control_flow())
inst = (brw_inst *)inst->next;
return inst;
}
inline brw_inst *
bblock_t::last_non_control_flow_inst()
{