@@ -649,7 +649,12 @@ SPIRVType *LLVMToSPIRVBase::transSPIRVJointMatrixINTELType(
649
649
650
650
auto ParseInteger = [this ](StringRef Postfix) -> ConstantInt * {
651
651
unsigned long long N = 0 ;
652
- consumeUnsignedInteger (Postfix, 10 , N);
652
+ if (consumeUnsignedInteger (Postfix, 10 , N)) {
653
+ BM->getErrorLog ().checkError (
654
+ false , SPIRVEC_InvalidLlvmModule,
655
+ " TypeJointMatrixINTEL expects integer parameters" );
656
+ return 0 ;
657
+ }
653
658
return getUInt32 (M, N);
654
659
};
655
660
std::vector<SPIRVValue *> Args;
@@ -2886,17 +2891,17 @@ void processAnnotationString(IntrinsicInst *II, std::string &AnnotationString) {
2886
2891
auto *StrValTy = StrVal->getType ();
2887
2892
if (StrValTy->isOpaquePointerTy ()) {
2888
2893
StringRef StrRef;
2889
- getConstantStringInfo (dyn_cast<Constant>(StrVal), StrRef);
2890
- AnnotationString += StrRef.str ();
2894
+ if ( getConstantStringInfo (dyn_cast<Constant>(StrVal), StrRef))
2895
+ AnnotationString += StrRef.str ();
2891
2896
if (auto *C = dyn_cast_or_null<Constant>(II->getArgOperand (4 )))
2892
2897
processOptionalAnnotationInfo (C, AnnotationString);
2893
2898
return ;
2894
2899
}
2895
2900
if (auto *GEP = dyn_cast<GetElementPtrInst>(StrVal)) {
2896
2901
if (auto *C = dyn_cast<Constant>(GEP->getOperand (0 ))) {
2897
2902
StringRef StrRef;
2898
- getConstantStringInfo (C, StrRef);
2899
- AnnotationString += StrRef.str ();
2903
+ if ( getConstantStringInfo (C, StrRef))
2904
+ AnnotationString += StrRef.str ();
2900
2905
}
2901
2906
}
2902
2907
if (auto *Cast = dyn_cast<BitCastInst>(II->getArgOperand (4 )))
@@ -3821,7 +3826,8 @@ SPIRVValue *LLVMToSPIRVBase::transIntrinsicInst(IntrinsicInst *II,
3821
3826
return nullptr ;
3822
3827
Constant *C = cast<Constant>(GEP->getOperand (0 ));
3823
3828
StringRef AnnotationString;
3824
- getConstantStringInfo (C, AnnotationString);
3829
+ if (!getConstantStringInfo (C, AnnotationString))
3830
+ return nullptr ;
3825
3831
3826
3832
if (AnnotationString == kOCLBuiltinName ::FPGARegIntel) {
3827
3833
if (BM->isAllowedToUseExtension (ExtensionID::SPV_INTEL_fpga_reg))
@@ -4316,7 +4322,10 @@ void LLVMToSPIRVBase::transGlobalAnnotation(GlobalVariable *V) {
4316
4322
cast<GlobalVariable>(CS->getOperand (1 )->stripPointerCasts ());
4317
4323
4318
4324
StringRef AnnotationString;
4319
- getConstantStringInfo (GV, AnnotationString);
4325
+ if (!getConstantStringInfo (GV, AnnotationString)) {
4326
+ assert (!" Annotation string missing" );
4327
+ return ;
4328
+ }
4320
4329
DecorationsInfoVec Decorations =
4321
4330
tryParseAnnotationString (BM, AnnotationString).MemoryAttributesVec ;
4322
4331
0 commit comments