@@ -80,8 +80,11 @@ static int parseSPVExtOption(
8080 llvm::SmallVector<llvm::StringRef, 32 > SPVExtList;
8181 llvm::SplitString (SPVExt, SPVExtList, " ," );
8282
83- if (SPVExtList.empty ())
84- return 0 ; // Nothing to do
83+ if (SPVExtList.empty ()) {
84+ llvm::errs () << " Invalid value of --spirv-ext, expected format is:\n "
85+ << " \t --spirv-ext=+EXT_NAME,-EXT_NAME\n " ;
86+ return -1 ;
87+ }
8588
8689 for (unsigned i = 0 ; i < SPVExtList.size (); ++i) {
8790 llvm::StringRef ExtString = SPVExtList[i];
@@ -106,14 +109,11 @@ static int parseSPVExtOption(
106109 for (const auto &It : ExtensionNamesMap)
107110 ExtensionsStatus[It.second ] = ExtStatus;
108111 } else {
109- // Reject unknown extensions
112+ // Ignore unknown extensions, as targets may support non-standard SPIR-V
113+ // extensions. Do not reject them; this approach is more tolerant.
110114 const auto &It = ExtensionNamesMap.find (ExtName);
111- if (ExtensionNamesMap.end () == It) {
112- llvm::errs () << " Unknown extension '" << ExtName
113- << " ' was specified via "
114- << " --spirv-ext option\n " ;
115- return -1 ;
116- }
115+ if (ExtensionNamesMap.end () == It)
116+ continue ;
117117
118118 ExtensionsStatus[It->second ] = ExtStatus;
119119 }
0 commit comments