On Thu, Jul 10, 2014 at 4:12 PM, Brian Paul <bri...@vmware.com> wrote: > BTW, looking at these algebraic simplifications in general, where do we > check for operands with side-effects? For example, in the "1^x == 1" > optimization, suppose x is a function call which modifies a global. Removing > x would be invalid, right?
Function calls (ir_call) are not R-values (ir_rvalues), so they can never appear in an expression tree. They can only appear as top-level ir_instructions, so return_something() in 1^return_something() would appear as an ir_call in the instruction list, and then its result (an ir_variable) could be used in an expression tree. GLSL IR's expression trees are pure, i.e., they have no side effects. _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev