aco/ra: fix usage of invalidated iterator

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Fixes: 58bd9a379e ("aco/ra: fix live-range splits of phi definitions")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16454>
This commit is contained in:
Rhys Perry 2022-05-11 15:10:22 +01:00 committed by Marge Bot
parent 42a4a123a6
commit cd2b4c319a

View file

@ -2120,7 +2120,10 @@ get_regs_for_phis(ra_ctx& ctx, Block& block, RegisterFile& register_file,
}
/* find registers for phis where the register was blocked or no operand was assigned */
for (aco_ptr<Instruction>& phi : instructions) {
/* Don't use iterators because get_reg_phi() can add phis to the end of the vector. */
for (unsigned i = 0; i < instructions.size(); i++) {
aco_ptr<Instruction>& phi = instructions[i];
Definition& definition = phi->definitions[0];
if (definition.isFixed())
continue;