Hi,
On 01/12/21 17:14, Matteo Bruni wrote:
changelog: Continue copy propagation after encountering an IF, rework to store the copy_propagation_state structs on the stack and search recursively
I still don't like these changes, they make the code more complicated than it should be, but I'll live with them.
However, I think you're introducing some missed optimizations with this specific patch. For example, take this code:
float2 a; a.x = 1.0; if (condition) { a.y = 2.0; do_something(a.x); }
You would expect a.x replaced with 1.0 in do_something(), but I don't think that's happening in you implementation: inside the conditional a new copy_propagation_var_def is created for variable a, which masks the previous knowledge about a.x being 1.0. This can probably be fixed in copy_propagation_create_var_def in the missing entry case by first doing a lookup on the lower frames and using that result, if it exists, to initialize the new copy_propagation_var_def.
Giovanni.