Skip to content

Commit fef4b65

Browse files
committed
fix to support BuiltinType
1 parent e6b4ab6 commit fef4b65

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

clang/lib/CodeGen/CGExprScalar.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2980,10 +2980,13 @@ Value *ScalarExprEmitter::VisitCastExpr(CastExpr *CE) {
29802980
assert((DestTy->isConstantMatrixType() || DestTy->isBuiltinType()) &&
29812981
"Destination type must be a matrix or builtin type.");
29822982
Value *Mat = Visit(E);
2983-
auto *MatTy = DestTy->getAs<ConstantMatrixType>();
2983+
unsigned NumCols = 1;
2984+
unsigned NumRows = 1;
29842985
SmallVector<int> Mask;
2985-
unsigned NumCols = MatTy->getNumColumns();
2986-
unsigned NumRows = MatTy->getNumRows();
2986+
if (auto *MatTy = DestTy->getAs<ConstantMatrixType>()) {
2987+
NumCols = MatTy->getNumColumns();
2988+
NumRows = MatTy->getNumRows();
2989+
}
29872990
unsigned ColOffset = NumCols;
29882991
if (auto *SrcMatTy = E->getType()->getAs<ConstantMatrixType>())
29892992
ColOffset = SrcMatTy->getNumColumns();

0 commit comments

Comments
 (0)