@@ -85,8 +85,11 @@ static int parseSPVExtOption(
8585 llvm::SmallVector<llvm::StringRef, 32 > SPVExtList;
8686 llvm::SplitString (SPVExt, SPVExtList, " ," );
8787
88- if (SPVExtList.empty ())
89- return 0 ; // Nothing to do
88+ if (SPVExtList.empty ()) {
89+ llvm::errs () << " Invalid value of --spirv-ext, expected format is:\n "
90+ << " \t --spirv-ext=+EXT_NAME,-EXT_NAME\n " ;
91+ return -1 ;
92+ }
9093
9194 for (unsigned i = 0 ; i < SPVExtList.size (); ++i) {
9295 llvm::StringRef ExtString = SPVExtList[i];
@@ -111,14 +114,11 @@ static int parseSPVExtOption(
111114 for (const auto &It : ExtensionNamesMap)
112115 ExtensionsStatus[It.second ] = ExtStatus;
113116 } else {
114- // Reject unknown extensions
117+ // Ignore unknown extensions, as targets may support non-standard SPIR-V
118+ // extensions. Do not reject them; this approach is more tolerant.
115119 const auto &It = ExtensionNamesMap.find (ExtName);
116- if (ExtensionNamesMap.end () == It) {
117- llvm::errs () << " Unknown extension '" << ExtName
118- << " ' was specified via "
119- << " --spirv-ext option\n " ;
120- return -1 ;
121- }
120+ if (ExtensionNamesMap.end () == It)
121+ continue ;
122122
123123 ExtensionsStatus[It->second ] = ExtStatus;
124124 }
0 commit comments