|
51 | 51 | #include "src/sksl/ir/SkSLVarDeclarations.h" |
52 | 52 | #include "src/sksl/ir/SkSLVariable.h" |
53 | 53 | #include "src/sksl/ir/SkSLVariableReference.h" |
54 | | -#include "src/sksl/ir/SkSLWhileStatement.h" |
55 | 54 |
|
56 | 55 | namespace SkSL { |
57 | 56 | namespace { |
@@ -100,7 +99,6 @@ static int count_returns_at_end_of_control_flow(const FunctionDefinition& funcDe |
100 | 99 | this->visitStatement(*block.children().back()); |
101 | 100 | } |
102 | 101 | case Statement::Kind::kSwitch: |
103 | | - case Statement::Kind::kWhile: |
104 | 102 | case Statement::Kind::kDo: |
105 | 103 | case Statement::Kind::kFor: |
106 | 104 | // Don't introspect switches or loop structures at all. |
@@ -132,7 +130,6 @@ static int count_returns_in_breakable_constructs(const FunctionDefinition& funcD |
132 | 130 | bool visitStatement(const Statement& stmt) override { |
133 | 131 | switch (stmt.kind()) { |
134 | 132 | case Statement::Kind::kSwitch: |
135 | | - case Statement::Kind::kWhile: |
136 | 133 | case Statement::Kind::kDo: |
137 | 134 | case Statement::Kind::kFor: { |
138 | 135 | ++fInsideBreakableConstruct; |
@@ -257,7 +254,7 @@ void Inliner::ensureScopedBlocks(Statement* inlinedBody, Statement* parentStmt) |
257 | 254 |
|
258 | 255 | // No changes necessary if the parent statement doesn't require a scope. |
259 | 256 | if (!parentStmt || !(parentStmt->is<IfStatement>() || parentStmt->is<ForStatement>() || |
260 | | - parentStmt->is<DoStatement>() || parentStmt->is<WhileStatement>())) { |
| 257 | + parentStmt->is<DoStatement>())) { |
261 | 258 | return; |
262 | 259 | } |
263 | 260 |
|
@@ -574,10 +571,6 @@ std::unique_ptr<Statement> Inliner::inlineStatement(int offset, |
574 | 571 | return std::make_unique<VarDeclaration>(clone, baseTypePtr, arraySize, |
575 | 572 | std::move(initialValue)); |
576 | 573 | } |
577 | | - case Statement::Kind::kWhile: { |
578 | | - const WhileStatement& w = statement.as<WhileStatement>(); |
579 | | - return std::make_unique<WhileStatement>(offset, expr(w.test()), stmt(w.statement())); |
580 | | - } |
581 | 574 | default: |
582 | 575 | SkASSERT(false); |
583 | 576 | return nullptr; |
@@ -956,20 +949,6 @@ class InlineCandidateAnalyzer { |
956 | 949 | this->visitExpression(&varDeclStmt.value()); |
957 | 950 | break; |
958 | 951 | } |
959 | | - case Statement::Kind::kWhile: { |
960 | | - WhileStatement& whileStmt = (*stmt)->as<WhileStatement>(); |
961 | | - // The loop body is a candidate for inlining. |
962 | | - this->visitStatement(&whileStmt.statement()); |
963 | | - // The inliner isn't smart enough to inline the test-expression for a while loop at |
964 | | - // this time. There are two limitations: |
965 | | - // - We would need to insert the inlined-body block at the very beginning of the |
966 | | - // while loop's inner fStatement. We don't support that today, but it's doable. |
967 | | - // - The while-loop's built-in test-expression would need to be replaced with a |
968 | | - // `true` BoolLiteral, and the loop would be halted via a break statement at the |
969 | | - // end of the inlined test-expression. This is again something we don't support |
970 | | - // today, but it could be implemented. |
971 | | - break; |
972 | | - } |
973 | 952 | default: |
974 | 953 | SkUNREACHABLE; |
975 | 954 | } |
|
0 commit comments