================
@@ -35,8 +35,10 @@ static constexpr Builtin::Info BuiltinInfos[] = {
static_assert(std::size(BuiltinInfos) == NumBuiltins);
llvm::SmallVector<Builtin::InfosShard>
-SPIRVTargetInfo::getTargetBuiltins() const {
- return {{&BuiltinStrings, BuiltinInfos}};
+BaseSPIRTargetInfo::getTargetBuiltins() const {
+ if (getTriple().isSPIRV())
+ return {{&BuiltinStrings, BuiltinInfos}};
----------------
farzonl wrote:
I don't understand why this change (in SPIR.cpp and SPIR.h) is necessesary.
The existing code accomplished the same thing with method overriding. The
original code also had some defensive programming safety to me. We went from a
compile time enforcement of SPIRVTargetInfo== BuiltinsSPIRV.td to now a
runtime enforcement. The problem with that is the next guy that comes along and
makes a change might assume the builtins so far are SPIRV and thats why you are
checking the triple, then add a new SPIR flavor builtin that would not be valid
for SPIRV.
https://github.com/llvm/llvm-project/pull/137805
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits