skia2/tests/sksl
John Stiles 8a9da73687 Fix overzealous optimization of short-circuits.
The previous implementation assumed that SkSL expressions do not have
side effects and so treated either side of a Boolean expression as
short-circuitable. That is, `foo() && false` and `false && foo()` would
both be optimized to `false`, eliminating the `foo()` call.

We now check for side effects first. An expression like `expr && false`
can only be optimized to `false` if `expr` has no side effects. (If
`expr` does have side effects, the expression is left as-is.)

Change-Id: I473cf026a8afe35d6a8d9518498f2b26d8996e60
Bug: skia:11162
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/356357
Commit-Queue: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
2021-01-20 20:24:27 +00:00
..
blend Reorder GLSL output so that functions are emitted last. 2021-01-15 23:15:46 +00:00
errors Enforce (valid) array sizes in many more places 2021-01-14 22:14:59 +00:00
folding Fix overzealous optimization of short-circuits. 2021-01-20 20:24:27 +00:00
fp Update glsltype_string and type_to_grsltype to a complete set. 2021-01-20 14:35:15 +00:00
glsl Replace array indexing on vector types with swizzles. 2020-12-07 21:16:40 +00:00
inliner Reorder GLSL output so that functions are emitted last. 2021-01-15 23:15:46 +00:00
intrinsics Generate valid Metal code when globals reference one another. 2021-01-19 17:07:24 +00:00
metal Generate valid Metal code when globals reference one another. 2021-01-19 17:07:24 +00:00
runtime Reland "Support indexing by loop variables in SkVMGenerator" 2021-01-19 22:33:46 +00:00
runtime_errors Enforce ES2 limits on indexing expressions (in runtime effects) 2021-01-15 22:49:27 +00:00
shared Implement constant folding for (bool == bool) and (bool != bool). 2021-01-20 14:22:35 +00:00
spirv Factor out SPIR-V typecasting helper functions. 2021-01-14 00:00:15 +00:00
workarounds Reorder GLSL output so that functions are emitted last. 2021-01-15 23:15:46 +00:00