diff options
author | Caio Marcelo de Oliveira Filho <[email protected]> | 2018-06-15 13:59:45 -0700 |
---|---|---|
committer | Caio Marcelo de Oliveira Filho <[email protected]> | 2018-07-16 16:33:39 -0700 |
commit | d7849fd1dafafa3489e0be389dabb09502dae26e (patch) | |
tree | 68fc9a1e525b4dd1dd3aeb0cf991771a9f87751a /src/gallium/drivers/virgl/virgl_encode.c | |
parent | 229836fb379eea6fb34c31410203082e822f3213 (diff) |
glsl: don't let an 'if' then-branch kill const propagation for else-branch
When handling 'if' in constant propagation, if a certain variable was
killed when processing the first branch of the 'if', then the second
would get any propagation from previous nodes. This is similar to the
change done for copy propagation code.
x = 1;
if (...) {
z = x; // This would turn into z = 1.
x = 22; // x gets killed.
} else {
w = x; // This would NOT turn into w = 1.
}
With the change, we let constant propagation happen independently in
the two branches and only then apply the killed values for the
subsequent code.
The new code use a single hash table for keeping the kills of both
branches (the branches only write to it), and it gets deleted after we
use -- instead of waiting for mem_ctx to collect it.
NIR deals well with constant propagation, so it already covered for
the missing ones that this patch fixes.
Reviewed-by: Eric Anholt <[email protected]>
Diffstat (limited to 'src/gallium/drivers/virgl/virgl_encode.c')
0 files changed, 0 insertions, 0 deletions