Convert IRGenerator::convertIf to IfStatement::Make.
This lets the Rehydrator and Inliner benefit from static optimization
opportunities, like converting `if (false) {...}` to a Nop.
Change-Id: I70b4fceab84c50ea270dc894b0d6fe0e7e2369eb
Bug: skia:11342
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/375777
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
diff --git a/src/sksl/SkSLInliner.cpp b/src/sksl/SkSLInliner.cpp
index e8ac206..59e6966 100644
--- a/src/sksl/SkSLInliner.cpp
+++ b/src/sksl/SkSLInliner.cpp
@@ -467,8 +467,8 @@
}
case Statement::Kind::kIf: {
const IfStatement& i = statement.as<IfStatement>();
- return std::make_unique<IfStatement>(offset, i.isStatic(), expr(i.test()),
- stmt(i.ifTrue()), stmt(i.ifFalse()));
+ return IfStatement::Make(*fContext, offset, i.isStatic(), expr(i.test()),
+ stmt(i.ifTrue()), stmt(i.ifFalse()));
}
case Statement::Kind::kInlineMarker:
case Statement::Kind::kNop: