Add SkSL test demonstrating missed optimization with +=.
Currently, SkSL is able to constant-propagate `x = x + constant` into
`x = constant` when the starting value of x is known. However, it is not
able to do the same optimization for `x += constant`. This test
demonstrates that once += is encountered, we lose track of x's value and
can no longer propagate its value.
(This is equally true of all the op-assignment operators, += -=
*= /= etc.)
Change-Id: I3523e96baf9a73982cf3b09f0d23b95adacf106b
Bug: skia:11192
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/368248
Auto-Submit: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
diff --git a/gn/sksl_tests.gni b/gn/sksl_tests.gni
index 78de0d2..8cff80b 100644
--- a/gn/sksl_tests.gni
+++ b/gn/sksl_tests.gni
@@ -418,6 +418,7 @@
]
sksl_folding_tests = [
+ "/sksl/folding/AssignmentOps.sksl",
"/sksl/folding/BoolFolding.sksl",
"/sksl/folding/FloatFolding.sksl",
"/sksl/folding/IntFoldingES2.sksl",