@@ -653,7 +653,12 @@ SPIRVType *LLVMToSPIRVBase::transSPIRVJointMatrixINTELType(
653
653
654
654
auto ParseInteger = [this ](StringRef Postfix) -> ConstantInt * {
655
655
unsigned long long N = 0 ;
656
- consumeUnsignedInteger (Postfix, 10 , N);
656
+ if (consumeUnsignedInteger (Postfix, 10 , N)) {
657
+ BM->getErrorLog ().checkError (
658
+ false , SPIRVEC_InvalidLlvmModule,
659
+ " TypeJointMatrixINTEL expects integer parameters" );
660
+ return 0 ;
661
+ }
657
662
return getUInt32 (M, N);
658
663
};
659
664
std::vector<SPIRVValue *> Args;
@@ -2950,17 +2955,17 @@ void processAnnotationString(IntrinsicInst *II, std::string &AnnotationString) {
2950
2955
auto *StrValTy = StrVal->getType ();
2951
2956
if (StrValTy->isOpaquePointerTy ()) {
2952
2957
StringRef StrRef;
2953
- getConstantStringInfo (dyn_cast<Constant>(StrVal), StrRef);
2954
- AnnotationString += StrRef.str ();
2958
+ if ( getConstantStringInfo (dyn_cast<Constant>(StrVal), StrRef))
2959
+ AnnotationString += StrRef.str ();
2955
2960
if (auto *C = dyn_cast_or_null<Constant>(II->getArgOperand (4 )))
2956
2961
processOptionalAnnotationInfo (C, AnnotationString);
2957
2962
return ;
2958
2963
}
2959
2964
if (auto *GEP = dyn_cast<GetElementPtrInst>(StrVal)) {
2960
2965
if (auto *C = dyn_cast<Constant>(GEP->getOperand (0 ))) {
2961
2966
StringRef StrRef;
2962
- getConstantStringInfo (C, StrRef);
2963
- AnnotationString += StrRef.str ();
2967
+ if ( getConstantStringInfo (C, StrRef))
2968
+ AnnotationString += StrRef.str ();
2964
2969
}
2965
2970
}
2966
2971
if (auto *Cast = dyn_cast<BitCastInst>(II->getArgOperand (4 )))
@@ -3885,7 +3890,8 @@ SPIRVValue *LLVMToSPIRVBase::transIntrinsicInst(IntrinsicInst *II,
3885
3890
return nullptr ;
3886
3891
Constant *C = cast<Constant>(GEP->getOperand (0 ));
3887
3892
StringRef AnnotationString;
3888
- getConstantStringInfo (C, AnnotationString);
3893
+ if (!getConstantStringInfo (C, AnnotationString))
3894
+ return nullptr ;
3889
3895
3890
3896
if (AnnotationString == kOCLBuiltinName ::FPGARegIntel) {
3891
3897
if (BM->isAllowedToUseExtension (ExtensionID::SPV_INTEL_fpga_reg))
@@ -4379,7 +4385,10 @@ void LLVMToSPIRVBase::transGlobalAnnotation(GlobalVariable *V) {
4379
4385
cast<GlobalVariable>(CS->getOperand (1 )->stripPointerCasts ());
4380
4386
4381
4387
StringRef AnnotationString;
4382
- getConstantStringInfo (GV, AnnotationString);
4388
+ if (!getConstantStringInfo (GV, AnnotationString)) {
4389
+ assert (!" Annotation string missing" );
4390
+ return ;
4391
+ }
4383
4392
DecorationsInfoVec Decorations =
4384
4393
tryParseAnnotationString (BM, AnnotationString).MemoryAttributesVec ;
4385
4394
0 commit comments