[Mesa-dev] [PATCH] glsl: Small optimization for constant conditionals
Iago Toral Quiroga
itoral at igalia.com
Tue Apr 15 03:30:39 PDT 2014
We are traversing the relevant branch manually with a for loop to insert the
instructions one by one. I think we can insert all the instructions in a single
operation using a list insert instead.
One thing to notice, the insert_before() method for lists will call
make_empty() on the passed list after insertion. This means that if the
"then" branch is the one selected, for example, its instructions will be
inserted and then, the "then" instruction list of the "if" statement
will be emptied, which is a difference with the current implementation.
I guess this is not a problem since the entire if statement is immediately
removed afterwards, but I thought I'd mention this just in case someone more
familiar with the code sees a problem with this. In any case, if this is a
problem it does not invalidate the idea since we could do the same thing but
avoiding the make_empty() call at the end.
Iago Toral Quiroga (1):
glsl: Small optimization for constant conditionals
src/glsl/opt_if_simplification.cpp | 10 ++--------
1 file changed, 2 insertions(+), 8 deletions(-)
--
1.8.3.2
More information about the mesa-dev
mailing list