[llvm] 20f650b - [SPIR-V] Remove redundant check and fix typos

Michal Paszkowski via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 1 15:56:29 PST 2023


Author: Michal Paszkowski
Date: 2023-03-02T00:54:50+01:00
New Revision: 20f650b231e324bdee619a57efef87c7b5d56b36

URL: https://github.com/llvm/llvm-project/commit/20f650b231e324bdee619a57efef87c7b5d56b36
DIFF: https://github.com/llvm/llvm-project/commit/20f650b231e324bdee619a57efef87c7b5d56b36.diff

LOG: [SPIR-V] Remove redundant check and fix typos

Added: 
    

Modified: 
    llvm/lib/IR/Type.cpp
    llvm/lib/Target/SPIRV/SPIRVBuiltins.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/IR/Type.cpp b/llvm/lib/IR/Type.cpp
index 0966016200838..b2da840ea6931 100644
--- a/llvm/lib/IR/Type.cpp
+++ b/llvm/lib/IR/Type.cpp
@@ -859,10 +859,9 @@ struct TargetTypeInfo {
 static TargetTypeInfo getTargetTypeInfo(const TargetExtType *Ty) {
   LLVMContext &C = Ty->getContext();
   StringRef Name = Ty->getName();
-  if (Name.startswith("spirv.") || Name.startswith("opencl.")) {
+  if (Name.startswith("spirv."))
     return TargetTypeInfo(Type::getInt8PtrTy(C, 0), TargetExtType::HasZeroInit,
                           TargetExtType::CanBeGlobal);
-  }
 
   // Opaque types in the AArch64 name space.
   if (Name == "aarch64.svcount")

diff  --git a/llvm/lib/Target/SPIRV/SPIRVBuiltins.cpp b/llvm/lib/Target/SPIRV/SPIRVBuiltins.cpp
index 1e0f8ca87a20c..a69e8c4612823 100644
--- a/llvm/lib/Target/SPIRV/SPIRVBuiltins.cpp
+++ b/llvm/lib/Target/SPIRV/SPIRVBuiltins.cpp
@@ -1975,7 +1975,7 @@ static const TargetExtType *parseToTargetExtType(const Type *OpaqueType,
   assert(NameWithParameters.startswith("spirv.") &&
          "Unknown builtin opaque type!");
 
-  // Parametrized SPIR-V builtins names follow this format:
+  // Parameterized SPIR-V builtins names follow this format:
   // e.g. %spirv.Image._void_1_0_0_0_0_0_0, %spirv.Pipe._0
   if (NameWithParameters.find('_') == std::string::npos)
     return TargetExtType::get(OpaqueType->getContext(), NameWithParameters);
@@ -1985,12 +1985,12 @@ static const TargetExtType *parseToTargetExtType(const Type *OpaqueType,
   SplitString(NameWithParameters.substr(BaseNameLength + 1), Parameters, "_");
 
   SmallVector<Type *, 1> TypeParameters;
-  bool HasTypeParamter = !isDigit(Parameters[0][0]);
-  if (HasTypeParamter)
+  bool HasTypeParameter = !isDigit(Parameters[0][0]);
+  if (HasTypeParameter)
     TypeParameters.push_back(parseTypeString(
         Parameters[0], MIRBuilder.getMF().getFunction().getContext()));
   SmallVector<unsigned> IntParameters;
-  for (unsigned i = HasTypeParamter ? 1 : 0; i < Parameters.size(); i++) {
+  for (unsigned i = HasTypeParameter ? 1 : 0; i < Parameters.size(); i++) {
     unsigned IntParameter = 0;
     bool ValidLiteral = !Parameters[i].getAsInteger(10, IntParameter);
     assert(ValidLiteral &&
@@ -2006,10 +2006,10 @@ static const TargetExtType *parseToTargetExtType(const Type *OpaqueType,
 // Implementation functions for builtin types.
 //===----------------------------------------------------------------------===//
 
-static SPIRVType *getNonParametrizedType(const TargetExtType *ExtensionType,
-                                         const SPIRV::BuiltinType *TypeRecord,
-                                         MachineIRBuilder &MIRBuilder,
-                                         SPIRVGlobalRegistry *GR) {
+static SPIRVType *getNonParameterizedType(const TargetExtType *ExtensionType,
+                                          const SPIRV::BuiltinType *TypeRecord,
+                                          MachineIRBuilder &MIRBuilder,
+                                          SPIRVGlobalRegistry *GR) {
   unsigned Opcode = TypeRecord->Opcode;
   // Create or get an existing type from GlobalRegistry.
   return GR->getOrCreateOpTypeByOpcode(ExtensionType, MIRBuilder, Opcode);
@@ -2114,7 +2114,7 @@ SPIRVType *lowerBuiltinType(const Type *OpaqueType,
     break;
   default:
     TargetType =
-        getNonParametrizedType(BuiltinType, TypeRecord, MIRBuilder, GR);
+        getNonParameterizedType(BuiltinType, TypeRecord, MIRBuilder, GR);
     break;
   }
 


        


More information about the llvm-commits mailing list