[llvm] r258017 - [TableGen] Use std::find instead of a manual loop. NFC

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Sun Jan 17 11:51:15 PST 2016


Author: ctopper
Date: Sun Jan 17 13:51:14 2016
New Revision: 258017

URL: http://llvm.org/viewvc/llvm-project?rev=258017&view=rev
Log:
[TableGen] Use std::find instead of a manual loop. NFC

Modified:
    llvm/trunk/utils/TableGen/CodeGenTarget.h

Modified: llvm/trunk/utils/TableGen/CodeGenTarget.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/CodeGenTarget.h?rev=258017&r1=258016&r2=258017&view=diff
==============================================================================
--- llvm/trunk/utils/TableGen/CodeGenTarget.h (original)
+++ llvm/trunk/utils/TableGen/CodeGenTarget.h Sun Jan 17 13:51:14 2016
@@ -139,9 +139,7 @@ public:
   /// supported by the target (i.e. there are registers that directly hold it).
   bool isLegalValueType(MVT::SimpleValueType VT) const {
     ArrayRef<MVT::SimpleValueType> LegalVTs = getLegalValueTypes();
-    for (unsigned i = 0, e = LegalVTs.size(); i != e; ++i)
-      if (LegalVTs[i] == VT) return true;
-    return false;
+    return std::find(LegalVTs.begin(), LegalVTs.end(), VT) != LegalVTs.end();
   }
 
   CodeGenSchedModels &getSchedModels() const;




More information about the llvm-commits mailing list