r600/sfn: Don't try to re-use the iterator when uses is updated

It seems on libc++ the iterator is invalidated when an element is removed
from the set, so make sure that we don't implicitely use the old,
invalidated iterator in the range based - open code the loop using while
instead.

Fixes: f3415c (r600/sfn: copy propagate register load chains)

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/7931

Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20394>
This commit is contained in:
Gert Wollny 2022-12-20 15:22:40 +01:00 committed by Marge Bot
parent aace38c2d8
commit 05fab97b2c

View file

@ -360,7 +360,12 @@ CopyPropFwdVisitor::visit(AluInstr *instr)
auto src = instr->psrc(0); auto src = instr->psrc(0);
auto dest = instr->dest(); auto dest = instr->dest();
for (auto& i : dest->uses()) { auto ii = dest->uses().begin();
auto ie = dest->uses().end();
while(ii != ie) {
auto i = *ii;
++ii;
/* SSA can always be propagated, registers only in the same block /* SSA can always be propagated, registers only in the same block
* and only if they are assigned in the same block */ * and only if they are assigned in the same block */
bool can_propagate = dest->has_flag(Register::ssa); bool can_propagate = dest->has_flag(Register::ssa);