c5ff48648a
Previously, a return statement inside a scoped Block would always result in the return expression being assigned to a temporary variable instead of replacing the function-call-expression directly. This was done because there might be variables inside the Block; these would have fallen out of scope when the expression is migrated to the call site, resulting in an invalid expression. We aren't actually examining the return expression so we don't know if it uses variables from an inner scope at all. (Inspecting the return expression for variable usage is certainly possible! But it's a fair amount of code and complexity for a small payoff.) However, we can very easily get most of the benefit here without paying for the complexity. In this CL we now look for variable declarations inside of scoped Blocks. If the code doesn't add any vardecls into scoped Blocks, there's no risk of scope problems, and we don't need to use a temp-var to store our return expressions. If any vardecls are added, we go back to using a temp-var as before. Change-Id: I4c81400dad2f33db06a1c18eb671ba2140232006 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/346499 Commit-Queue: John Stiles <johnstiles@google.com> Auto-Submit: John Stiles <johnstiles@google.com> Reviewed-by: Brian Osman <brianosman@google.com> |
||
---|---|---|
.. | ||
DoWhileBodyMustBeInlinedIntoAScope.glsl | ||
DoWhileTestCannotBeInlined.glsl | ||
ExponentialGrowth.glsl | ||
ExponentialGrowthStandaloneSettings.glsl | ||
ForBodyMustBeInlinedIntoAScope.glsl | ||
ForInitializerExpressionsCanBeInlined.glsl | ||
ForWithoutReturnInsideCanBeInlined.glsl | ||
ForWithReturnInsideCannotBeInlined.glsl | ||
IfBodyMustBeInlinedIntoAScope.glsl | ||
IfElseBodyMustBeInlinedIntoAScope.glsl | ||
IfElseChainWithReturnsCanBeInlined.glsl | ||
IfTestCanBeInlined.glsl | ||
IfWithReturnsCanBeInlined.glsl | ||
InlineKeywordOverridesThreshold.glsl | ||
InlinerAvoidsVariableNameOverlap.glsl | ||
InlinerCanBeDisabled.glsl | ||
InlinerCanBeDisabledStandaloneSettings.glsl | ||
InlinerElidesTempVarForReturnsInsideBlock.glsl | ||
InlinerManglesNames.glsl | ||
InlinerUsesTempVarForMultipleReturns.glsl | ||
InlinerUsesTempVarForReturnsInsideBlockWithVar.glsl | ||
InlinerWrapsEarlyReturnsWithForLoop.glsl | ||
InlinerWrapsSwitchWithReturnInsideWithForLoop.glsl | ||
InlineThreshold.glsl | ||
InlineWithInoutArgument.glsl | ||
InlineWithModifiedArgument.glsl | ||
InlineWithNestedBigCalls.glsl | ||
InlineWithNestedCalls.glsl | ||
InlineWithUnmodifiedArgument.glsl | ||
InlineWithUnnecessaryBlocks.glsl | ||
ShortCircuitEvaluationsCannotInlineRightHandSide.glsl | ||
SwitchWithCastCanBeInlined.glsl | ||
SwitchWithoutReturnInsideCanBeInlined.glsl | ||
SwizzleCanBeInlinedDirectly.glsl | ||
TernaryResultsCannotBeInlined.glsl | ||
TernaryTestCanBeInlined.glsl | ||
TrivialArgumentsInlineDirectly.glsl | ||
WhileBodyMustBeInlinedIntoAScope.glsl | ||
WhileTestCannotBeInlined.glsl |