glsl: fix potential crash in expression flattening

The base_ir variable used by this pass is set via visit_list_elements()
however this pass was skipping visit_list_elements() for the initial
list of instructions i.e. it was skipping it for globals so if we
ended up trying to flatten an expression on a global we would segfault.

To quote the code comment on the base_ir variable:

   "This is implemented by visit_list_elements -- if the visitor is
   not called by it, nothing good will happen"

Reviewed-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27743>
This commit is contained in:
Timothy Arceri 2024-02-22 13:00:09 +11:00 committed by Marge Bot
parent ac45d893d6
commit 82d617e8b1

View file

@ -56,10 +56,7 @@ do_expression_flattening(exec_list *instructions,
bool (*predicate)(ir_instruction *ir))
{
ir_expression_flattening_visitor v(predicate);
foreach_in_list(ir_instruction, ir, instructions) {
ir->accept(&v);
}
visit_list_elements(&v, instructions);
}
void