aco: Move is_dead to aco_ir.h to allow it to get inlined.

Signed-off-by: Timur Kristóf <timur.kristof@gmail.com>
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18103>
This commit is contained in:
Timur Kristóf 2022-10-06 10:21:55 -05:00 committed by Marge Bot
parent 36bc3afb8b
commit 0cceab788e
2 changed files with 14 additions and 13 deletions

View file

@ -80,18 +80,6 @@ process_block(dce_ctx& ctx, Block& block)
} /* end namespace */
bool
is_dead(const std::vector<uint16_t>& uses, Instruction* instr)
{
if (instr->definitions.empty() || instr->isBranch() ||
instr->opcode == aco_opcode::p_init_scratch)
return false;
if (std::any_of(instr->definitions.begin(), instr->definitions.end(),
[&uses](const Definition& def) { return !def.isTemp() || uses[def.tempId()]; }))
return false;
return !(get_sync_info(instr).semantics & (semantic_volatile | semantic_acqrel));
}
std::vector<uint16_t>
dead_code_analysis(Program* program)
{

View file

@ -33,6 +33,7 @@
#include "nir.h"
#include <algorithm>
#include <bitset>
#include <memory>
#include <vector>
@ -1851,7 +1852,19 @@ is_phi(aco_ptr<Instruction>& instr)
memory_sync_info get_sync_info(const Instruction* instr);
bool is_dead(const std::vector<uint16_t>& uses, Instruction* instr);
inline bool
is_dead(const std::vector<uint16_t>& uses, const Instruction* instr)
{
if (instr->definitions.empty() || instr->isBranch() ||
instr->opcode == aco_opcode::p_init_scratch)
return false;
if (std::any_of(instr->definitions.begin(), instr->definitions.end(),
[&uses](const Definition& def) { return !def.isTemp() || uses[def.tempId()]; }))
return false;
return !(get_sync_info(instr).semantics & (semantic_volatile | semantic_acqrel));
}
bool can_use_opsel(amd_gfx_level gfx_level, aco_opcode op, int idx);
bool instr_is_16bit(amd_gfx_level gfx_level, aco_opcode op);