skia2/resources/sksl/inliner
John Stiles 66c53b9428 Demonstrate a bug with inlined static switches.
When we detect a static switch, the optimizer finds the matching switch-
case and eliminates all the other switch-cases. It handles case
fall-through by scanning forward and looking for an unconditional break.

However, the inliner has an interesting quirk--it can replace `return`
statements inside of a switch with `continue` statements, since the body
of the inlined function has been wrapped with a for-loop to allow for
early exits. The optimizer does not recognize these continue statements
as exits from the switch (although they certainly qualify), so it
treats continues as fallen-through and keeps emitting switch-cases.

The dead-code elimination pass was actually doing us a favor here and
eliminating the excess code later. A flag was added to disable DCE in
order to reveal the problem in a test.

Change-Id: I8ff19fde5e32d0ab73d7c5411da40cb953a446f5
Bug: skia:11352
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/372956
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
2021-02-22 15:05:58 +00:00
..
DoWhileBodyMustBeInlinedIntoAScope.sksl Migrate SkSL test inputs to the resources/ directory. 2021-01-22 18:57:29 +00:00
DoWhileTestCannotBeInlined.sksl Migrate SkSL test inputs to the resources/ directory. 2021-01-22 18:57:29 +00:00
EnumsCanBeInlinedSafely.sksl Migrate SkSL test inputs to the resources/ directory. 2021-01-22 18:57:29 +00:00
ExponentialGrowth.sksl Migrate SkSL test inputs to the resources/ directory. 2021-01-22 18:57:29 +00:00
ForBodyMustBeInlinedIntoAScope.sksl Migrate SkSL test inputs to the resources/ directory. 2021-01-22 18:57:29 +00:00
ForInitializerExpressionsCanBeInlined.sksl Migrate SkSL test inputs to the resources/ directory. 2021-01-22 18:57:29 +00:00
ForWithoutReturnInsideCanBeInlined.sksl Migrate SkSL test inputs to the resources/ directory. 2021-01-22 18:57:29 +00:00
ForWithReturnInsideCannotBeInlined.sksl Migrate SkSL test inputs to the resources/ directory. 2021-01-22 18:57:29 +00:00
IfBodyMustBeInlinedIntoAScope.sksl Migrate SkSL test inputs to the resources/ directory. 2021-01-22 18:57:29 +00:00
IfElseBodyMustBeInlinedIntoAScope.sksl Migrate SkSL test inputs to the resources/ directory. 2021-01-22 18:57:29 +00:00
IfElseChainWithReturnsCanBeInlined.sksl Migrate SkSL test inputs to the resources/ directory. 2021-01-22 18:57:29 +00:00
IfTestCanBeInlined.sksl Migrate SkSL test inputs to the resources/ directory. 2021-01-22 18:57:29 +00:00
IfWithReturnsCanBeInlined.sksl Migrate SkSL test inputs to the resources/ directory. 2021-01-22 18:57:29 +00:00
InlineKeywordOverridesThreshold.sksl Migrate SkSL test inputs to the resources/ directory. 2021-01-22 18:57:29 +00:00
InlinerAvoidsVariableNameOverlap.sksl Migrate SkSL test inputs to the resources/ directory. 2021-01-22 18:57:29 +00:00
InlinerCanBeDisabled.sksl Migrate SkSL test inputs to the resources/ directory. 2021-01-22 18:57:29 +00:00
InlinerElidesTempVarForReturnsInsideBlock.sksl Migrate SkSL test inputs to the resources/ directory. 2021-01-22 18:57:29 +00:00
InlinerHonorsGLSLOutParamSemantics.sksl Add test to demonstrate out-param semantics violation. 2021-02-16 14:28:49 +00:00
InlinerManglesNames.sksl Migrate SkSL test inputs to the resources/ directory. 2021-01-22 18:57:29 +00:00
InlinerUsesTempVarForMultipleReturns.sksl Migrate SkSL test inputs to the resources/ directory. 2021-01-22 18:57:29 +00:00
InlinerUsesTempVarForReturnsInsideBlockWithVar.sksl Migrate SkSL test inputs to the resources/ directory. 2021-01-22 18:57:29 +00:00
InlinerWrapsEarlyReturnsWithForLoop.sksl Migrate SkSL test inputs to the resources/ directory. 2021-01-22 18:57:29 +00:00
InlinerWrapsSwitchWithReturnInsideWithForLoop.sksl Migrate SkSL test inputs to the resources/ directory. 2021-01-22 18:57:29 +00:00
InlineThreshold.sksl Migrate SkSL test inputs to the resources/ directory. 2021-01-22 18:57:29 +00:00
InlineWithInoutArgument.sksl Migrate SkSL test inputs to the resources/ directory. 2021-01-22 18:57:29 +00:00
InlineWithModifiedArgument.sksl Migrate SkSL test inputs to the resources/ directory. 2021-01-22 18:57:29 +00:00
InlineWithNestedBigCalls.sksl Migrate SkSL test inputs to the resources/ directory. 2021-01-22 18:57:29 +00:00
InlineWithNestedCalls.sksl Migrate SkSL test inputs to the resources/ directory. 2021-01-22 18:57:29 +00:00
InlineWithUnmodifiedArgument.sksl Migrate SkSL test inputs to the resources/ directory. 2021-01-22 18:57:29 +00:00
InlineWithUnnecessaryBlocks.sksl Migrate SkSL test inputs to the resources/ directory. 2021-01-22 18:57:29 +00:00
ShortCircuitEvaluationsCannotInlineRightHandSide.sksl Migrate SkSL test inputs to the resources/ directory. 2021-01-22 18:57:29 +00:00
StaticSwitch.sksl Demonstrate a bug with inlined static switches. 2021-02-22 15:05:58 +00:00
StructsCanBeInlinedSafely.sksl Migrate SkSL test inputs to the resources/ directory. 2021-01-22 18:57:29 +00:00
SwitchWithCastCanBeInlined.sksl Migrate SkSL test inputs to the resources/ directory. 2021-01-22 18:57:29 +00:00
SwitchWithoutReturnInsideCanBeInlined.sksl Migrate SkSL test inputs to the resources/ directory. 2021-01-22 18:57:29 +00:00
SwizzleCanBeInlinedDirectly.sksl Migrate SkSL test inputs to the resources/ directory. 2021-01-22 18:57:29 +00:00
TernaryResultsCannotBeInlined.sksl Migrate SkSL test inputs to the resources/ directory. 2021-01-22 18:57:29 +00:00
TernaryTestCanBeInlined.sksl Migrate SkSL test inputs to the resources/ directory. 2021-01-22 18:57:29 +00:00
TrivialArgumentsInlineDirectly.sksl Migrate SkSL test inputs to the resources/ directory. 2021-01-22 18:57:29 +00:00
WhileBodyMustBeInlinedIntoAScope.sksl Migrate SkSL test inputs to the resources/ directory. 2021-01-22 18:57:29 +00:00
WhileTestCannotBeInlined.sksl Migrate SkSL test inputs to the resources/ directory. 2021-01-22 18:57:29 +00:00