2
0
Эх сурвалжийг харах

Update HLMatrixType.cpp (#3415)

Calling getName() on a literal StructType will assert/segfault. Must check StructType::isLiteral first.
Sean Baxter 4 жил өмнө
parent
commit
067f9d912d

+ 2 - 2
lib/HLSL/HLMatrixType.cpp

@@ -104,7 +104,7 @@ Value *HLMatrixType::emitLoweredVectorColToRow(Value *VecVal, IRBuilder<> &Build
 
 bool HLMatrixType::isa(Type *Ty) {
   StructType *StructTy = llvm::dyn_cast<StructType>(Ty);
-  return StructTy != nullptr && StructTy->getName().startswith(StructNamePrefix);
+  return StructTy != nullptr && !StructTy->isLiteral() && StructTy->getName().startswith(StructNamePrefix);
 }
 
 bool HLMatrixType::isMatrixPtr(Type *Ty) {
@@ -176,4 +176,4 @@ HLMatrixType HLMatrixType::cast(Type *Ty) {
 
 HLMatrixType HLMatrixType::dyn_cast(Type *Ty) {
   return isa(Ty) ? cast(Ty) : HLMatrixType();
-}
+}