Add unit test for a dead do-while loop.

Ideally the optimizer should be able to detect and remove this loop.
This CL establishes a baseline.

Change-Id: I6aba0b52fe49552f170fca25d81c29c515044ef5
Bug: skia:10737
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/317861
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>
This commit is contained in:
John Stiles 2020-09-18 16:16:14 -04:00 committed by Skia Commit-Bot
parent 94f65d784c
commit 64fc15a279
3 changed files with 13 additions and 0 deletions

View File

@ -123,6 +123,7 @@ sksl_glsl_tests_sources = [
"$_tests/sksl/glsl/ConstVariableComparison.sksl",
"$_tests/sksl/glsl/ConstantIf.sksl",
"$_tests/sksl/glsl/Control.sksl",
"$_tests/sksl/glsl/DeadDoWhileLoop.sksl",
"$_tests/sksl/glsl/DeadLoopVariable.sksl",
"$_tests/sksl/glsl/DependentInitializers.sksl",
"$_tests/sksl/glsl/DerivativesUnused.sksl",

View File

@ -0,0 +1,5 @@
void main() {
do {
sk_FragColor = half4(1);
} while (false);
}

View File

@ -0,0 +1,7 @@
out vec4 sk_FragColor;
void main() {
do {
sk_FragColor = vec4(1.0);
} while (false);
}