aco: don't DCE atomics with return values
We don't create atomics with definitions if they are not used in NIR, but
our own DCE can remove the uses if an export turns out to be null.
Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Fixes: 93c8ebfa78 ('aco: Initial commit of independent AMD compiler')
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3081>
This commit is contained in:
@@ -2265,12 +2265,7 @@ void select_instruction(opt_ctx &ctx, aco_ptr<Instruction>& instr)
|
||||
{
|
||||
const uint32_t threshold = 4;
|
||||
|
||||
/* Dead Code Elimination:
|
||||
* We remove instructions if they define temporaries which all are unused */
|
||||
const bool is_used = instr->definitions.empty() ||
|
||||
std::any_of(instr->definitions.begin(), instr->definitions.end(),
|
||||
[&ctx](const Definition& def) { return ctx.uses[def.tempId()]; });
|
||||
if (!is_used) {
|
||||
if (is_dead(ctx.uses, instr.get())) {
|
||||
instr.reset();
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user