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()) {
diff --git a/src/sksl/ir/SkSLType.cpp b/src/sksl/ir/SkSLType.cpp
index 3ca280e..d5fdc65 100644
--- a/src/sksl/ir/SkSLType.cpp
+++ b/src/sksl/ir/SkSLType.cpp
@@ -9,6 +9,7 @@
 
 #include "src/sksl/SkSLContext.h"
 #include "src/sksl/ir/SkSLConstructor.h"
+#include "src/sksl/ir/SkSLConstructorCompoundCast.h"
 #include "src/sksl/ir/SkSLConstructorScalarCast.h"
 #include "src/sksl/ir/SkSLFunctionReference.h"
 #include "src/sksl/ir/SkSLSymbolTable.h"
@@ -268,12 +269,9 @@
         return nullptr;
     }
 
-    ExpressionArray args;
-    args.push_back(std::move(expr));
-    if (this->isScalar()) {
-        return ConstructorScalarCast::Convert(context, offset, *this, std::move(args));
-    }
-    return Constructor::Convert(context, offset, *this, std::move(args));
+    return this->isScalar()
+                   ? ConstructorScalarCast::Make(context, offset, *this, std::move(expr))
+                   : ConstructorCompoundCast::Make(context, offset, *this, std::move(expr));
 }
 
 bool Type::isOrContainsArray() const {