Simplify some Constructor::Convert calls.
When we know the input types ahead of time, it's more efficient to call
ConstructorFoo::Make than to call Constructor::Convert, because we can
cut out the complex logic in convert_compound_constructor.
Change-Id: I147faa6d613ebc90de5d9bbb14e0b6db235a1802
Bug: skia:11032
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/393397
Auto-Submit: John Stiles <johnstiles@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
diff --git a/src/sksl/SkSLConstantFolder.cpp b/src/sksl/SkSLConstantFolder.cpp
index d78edfb..862a0bc 100644
--- a/src/sksl/SkSLConstantFolder.cpp
+++ b/src/sksl/SkSLConstantFolder.cpp
@@ -14,6 +14,7 @@
#include "src/sksl/ir/SkSLBinaryExpression.h"
#include "src/sksl/ir/SkSLBoolLiteral.h"
#include "src/sksl/ir/SkSLConstructor.h"
+#include "src/sksl/ir/SkSLConstructorCompound.h"
#include "src/sksl/ir/SkSLConstructorSplat.h"
#include "src/sksl/ir/SkSLExpression.h"
#include "src/sksl/ir/SkSLFloatLiteral.h"
@@ -102,9 +103,7 @@
right.getConstantSubexpression(i)->as<Literal<T>>().value());
args.push_back(Literal<T>::Make(left.fOffset, value, &componentType));
}
- auto foldedCtor = Constructor::Convert(context, left.fOffset, type, std::move(args));
- SkASSERT(foldedCtor);
- return foldedCtor;
+ return ConstructorCompound::Make(context, left.fOffset, type, std::move(args));
};
switch (op.kind()) {