6fb520fcd5
- Values from constant variables are folded in when it helps, e.g.: const bool SHINY = true; const float SHININESS = 2; if (!SHINY) { // <-- optimizes directly to `false` param = -SHININESS; // <-- optimizes to `-2` - Doubled-up logical-not and negation are stripped: y = -(-x); // <-- optimizes to `y = x;` b = !!a; // <-- optimizes to `b = a;` Removal of doubled-up negation and logical-not was actually never implemented in the constant-propagation phase; I just noticed it while I was here and thinking about it. Change-Id: Ie28bb9b5af91376f03d926e26e37f4a131bbf550 Bug: skia:11343 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/379298 Auto-Submit: John Stiles <johnstiles@google.com> Commit-Queue: John Stiles <johnstiles@google.com> Reviewed-by: Brian Osman <brianosman@google.com>
25 lines
548 B
Plaintext
25 lines
548 B
Plaintext
uniform half4 colorGreen, colorRed;
|
|
|
|
half4 main() {
|
|
float x = 1, y = 2;
|
|
int z = 3;
|
|
x = x - x + y * x * x * (y - x);
|
|
y = x / y / x;
|
|
z = (z / 2 * 3 + 4) - 2;
|
|
bool b = (x > 4) == x < 2 || 2 >= sqrt(2) && y <= x;
|
|
bool c = sqrt(2) > 2;
|
|
bool d = b ^^ !!c;
|
|
bool e = b && c;
|
|
bool f = !!b || c;
|
|
x += 12;
|
|
x -= 12;
|
|
x *= y /= 10;
|
|
x = 6;
|
|
y = float(b) * float(c) * float(d) * float(e) * float(f);
|
|
y = 6;
|
|
z = z - 1;
|
|
z = 6;
|
|
|
|
return (x == 6 && y == 6 && z == 6) ? colorGreen : colorRed;
|
|
}
|