Use std::find instead of manual loop.
authorCraig Topper <craig.topper@gmail.com>
Sat, 17 Oct 2015 21:32:28 +0000 (21:32 +0000)
committerCraig Topper <craig.topper@gmail.com>
Sat, 17 Oct 2015 21:32:28 +0000 (21:32 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@250624 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/NVPTX/NVPTXISelLowering.cpp

index cc4fe211b6fc2eed94bdd2fdbb5fb1deecca08bb..d7324f2c1feb4d384de414a1c143a7a3aa0d7c4a 100644 (file)
@@ -2044,11 +2044,8 @@ bool llvm::isImageOrSamplerVal(const Value *arg, const Module *context) {
   auto *STy = dyn_cast<StructType>(PTy->getElementType());
   const std::string TypeName = STy && !STy->isLiteral() ? STy->getName() : "";
 
-  for (int i = 0, e = array_lengthof(specialTypes); i != e; ++i)
-    if (TypeName == specialTypes[i])
-      return true;
-
-  return false;
+  return std::find(std::begin(specialTypes), std::end(specialTypes),
+                   TypeName) != std::end(specialTypes);
 }
 
 SDValue NVPTXTargetLowering::LowerFormalArguments(