<div dir="ltr">Thanks.<div><br></div><div>-- Sean Silva</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Sat, Jan 25, 2014 at 11:56 AM, Artyom Skrobov <span dir="ltr"><<a href="mailto:Artyom.Skrobov@arm.com" target="_blank">Artyom.Skrobov@arm.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: askrobov<br>
Date: Sat Jan 25 10:56:18 2014<br>
New Revision: 200083<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=200083&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=200083&view=rev</a><br>
Log:<br>
Reverting r199886 (Prevent repetitive warnings for unrecognized processors and features)<br>
<br>
Removed:<br>
    llvm/trunk/test/MC/ARM/unrecognized.ll<br>
Modified:<br>
    llvm/trunk/include/llvm/MC/SubtargetFeature.h<br>
    llvm/trunk/lib/MC/MCSubtargetInfo.cpp<br>
    llvm/trunk/lib/MC/SubtargetFeature.cpp<br>
<br>
Modified: llvm/trunk/include/llvm/MC/SubtargetFeature.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/SubtargetFeature.h?rev=200083&r1=200082&r2=200083&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/SubtargetFeature.h?rev=200083&r1=200082&r2=200083&view=diff</a><br>

==============================================================================<br>
--- llvm/trunk/include/llvm/MC/SubtargetFeature.h (original)<br>
+++ llvm/trunk/include/llvm/MC/SubtargetFeature.h Sat Jan 25 10:56:18 2014<br>
@@ -101,12 +101,6 @@ public:<br>
<br>
   /// Adds the default features for the specified target triple.<br>
   void getDefaultSubtargetFeatures(const Triple& Triple);<br>
-<br>
-  /// Find KV in array using binary search.<br>
-  /// T should be either SubtargetFeatureKV or SubtargetInfoKV<br>
-  template<typename T><br>
-  static const T *Find(StringRef Key, const T *Array, size_t Length,<br>
-                       const char* KeyType);<br>
 };<br>
<br>
 } // End namespace llvm<br>
<br>
Modified: llvm/trunk/lib/MC/MCSubtargetInfo.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCSubtargetInfo.cpp?rev=200083&r1=200082&r2=200083&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCSubtargetInfo.cpp?rev=200083&r1=200082&r2=200083&view=diff</a><br>

==============================================================================<br>
--- llvm/trunk/lib/MC/MCSubtargetInfo.cpp (original)<br>
+++ llvm/trunk/lib/MC/MCSubtargetInfo.cpp Sat Jan 25 10:56:18 2014<br>
@@ -96,11 +96,14 @@ MCSubtargetInfo::getSchedModelForCPU(Str<br>
 #endif<br>
<br>
   // Find entry<br>
-  const SubtargetInfoKV *Found = SubtargetFeatures::Find(CPU, ProcSchedModels,<br>
-                                                         NumProcs, "processor");<br>
-  if (!Found)<br>
+  const SubtargetInfoKV *Found =<br>
+    std::lower_bound(ProcSchedModels, ProcSchedModels+NumProcs, CPU);<br>
+  if (Found == ProcSchedModels+NumProcs || StringRef(Found->Key) != CPU) {<br>
+    errs() << "'" << CPU<br>
+           << "' is not a recognized processor for this target"<br>
+           << " (ignoring processor)\n";<br>
     return &MCSchedModel::DefaultSchedModel;<br>
-<br>
+  }<br>
   assert(Found->Value && "Missing processor SchedModel value");<br>
   return (const MCSchedModel *)Found->Value;<br>
 }<br>
<br>
Modified: llvm/trunk/lib/MC/SubtargetFeature.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/SubtargetFeature.cpp?rev=200083&r1=200082&r2=200083&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/SubtargetFeature.cpp?rev=200083&r1=200082&r2=200083&view=diff</a><br>

==============================================================================<br>
--- llvm/trunk/lib/MC/SubtargetFeature.cpp (original)<br>
+++ llvm/trunk/lib/MC/SubtargetFeature.cpp Sat Jan 25 10:56:18 2014<br>
@@ -11,11 +11,9 @@<br>
 //<br>
 //===----------------------------------------------------------------------===//<br>
<br>
-#include "llvm/ADT/SmallSet.h"<br>
 #include "llvm/MC/SubtargetFeature.h"<br>
 #include "llvm/Support/Debug.h"<br>
 #include "llvm/Support/Format.h"<br>
-#include "llvm/Support/SourceMgr.h"<br>
 #include "llvm/Support/raw_ostream.h"<br>
 #include <algorithm><br>
 #include <cassert><br>
@@ -120,42 +118,19 @@ void SubtargetFeatures::AddFeature(const<br>
   }<br>
 }<br>
<br>
-// This needs to be shared between the instantiations of Find<><br>
-typedef std::pair<std::string,std::string> KeyWithType;<br>
-static SmallSet<KeyWithType,10> reportedAsUnrecognized;<br>
-<br>
 /// Find KV in array using binary search.<br>
-template<typename T><br>
-const T *SubtargetFeatures::Find(StringRef Key, const T *Array, size_t Length,<br>
-                                 const char* KeyType) {<br>
+static const SubtargetFeatureKV *Find(StringRef S, const SubtargetFeatureKV *A,<br>
+                                      size_t L) {<br>
   // Determine the end of the array<br>
-  const T *Hi = Array + Length;<br>
+  const SubtargetFeatureKV *Hi = A + L;<br>
   // Binary search the array<br>
-  const T *F = std::lower_bound(Array, Hi, Key);<br>
+  const SubtargetFeatureKV *F = std::lower_bound(A, Hi, S);<br>
   // If not found then return NULL<br>
-  if (F == Hi || StringRef(F->Key) != Key) {<br>
-    // If not yet reported, report now<br>
-    KeyWithType current(KeyType, Key);<br>
-    if(!reportedAsUnrecognized.count(current)) {<br>
-      SmallString<1024> storage;<br>
-      StringRef message = ("'" + Key +<br>
-                           "' is not a recognized " + KeyType +<br>
-                           " for this target (ignoring " + KeyType +<br>
-                           ")").toStringRef(storage);<br>
-      SMDiagnostic(StringRef(), SourceMgr::DK_Warning, message)<br>
-        .print(0, errs());<br>
-      reportedAsUnrecognized.insert(current);<br>
-    }<br>
-    return NULL;<br>
-  }<br>
+  if (F == Hi || StringRef(F->Key) != S) return NULL;<br>
   // Return the found array item<br>
   return F;<br>
 }<br>
<br>
-// Instantiate with <SubtargetInfoKV> for use in MCSubtargetInfo<br>
-template const SubtargetInfoKV *SubtargetFeatures::Find<SubtargetInfoKV><br>
-  (StringRef Key, const SubtargetInfoKV *Array, size_t Length, const char* KeyType);<br>
-<br>
 /// getLongestEntryLength - Return the length of the longest entry in the table.<br>
 ///<br>
 static size_t getLongestEntryLength(const SubtargetFeatureKV *Table,<br>
@@ -253,7 +228,7 @@ SubtargetFeatures::ToggleFeature(uint64_<br>
                                  size_t FeatureTableSize) {<br>
   // Find feature in table.<br>
   const SubtargetFeatureKV *FeatureEntry =<br>
-    Find(StripFlag(Feature), FeatureTable, FeatureTableSize, "feature");<br>
+    Find(StripFlag(Feature), FeatureTable, FeatureTableSize);<br>
   // If there is a match<br>
   if (FeatureEntry) {<br>
     if ((Bits & FeatureEntry->Value) == FeatureEntry->Value) {<br>
@@ -267,6 +242,10 @@ SubtargetFeatures::ToggleFeature(uint64_<br>
       // For each feature that this implies, set it.<br>
       SetImpliedBits(Bits, FeatureEntry, FeatureTable, FeatureTableSize);<br>
     }<br>
+  } else {<br>
+    errs() << "'" << Feature<br>
+           << "' is not a recognized feature for this target"<br>
+           << " (ignoring feature)\n";<br>
   }<br>
<br>
   return Bits;<br>
@@ -301,8 +280,7 @@ uint64_t SubtargetFeatures::getFeatureBi<br>
<br>
   // Find CPU entry if CPU name is specified.<br>
   if (!CPU.empty()) {<br>
-    const SubtargetFeatureKV *CPUEntry = Find(CPU, CPUTable, CPUTableSize,<br>
-                                              "processor");<br>
+    const SubtargetFeatureKV *CPUEntry = Find(CPU, CPUTable, CPUTableSize);<br>
     // If there is a match<br>
     if (CPUEntry) {<br>
       // Set base feature bits<br>
@@ -314,6 +292,10 @@ uint64_t SubtargetFeatures::getFeatureBi<br>
         if (CPUEntry->Value & FE.Value)<br>
           SetImpliedBits(Bits, &FE, FeatureTable, FeatureTableSize);<br>
       }<br>
+    } else {<br>
+      errs() << "'" << CPU<br>
+             << "' is not a recognized processor for this target"<br>
+             << " (ignoring processor)\n";<br>
     }<br>
   }<br>
<br>
@@ -327,7 +309,7 @@ uint64_t SubtargetFeatures::getFeatureBi<br>
<br>
     // Find feature in table.<br>
     const SubtargetFeatureKV *FeatureEntry =<br>
-            Find(StripFlag(Feature), FeatureTable, FeatureTableSize, "feature");<br>
+                       Find(StripFlag(Feature), FeatureTable, FeatureTableSize);<br>
     // If there is a match<br>
     if (FeatureEntry) {<br>
       // Enable/disable feature in bits<br>
@@ -342,6 +324,10 @@ uint64_t SubtargetFeatures::getFeatureBi<br>
         // For each feature that implies this, clear it.<br>
         ClearImpliedBits(Bits, FeatureEntry, FeatureTable, FeatureTableSize);<br>
       }<br>
+    } else {<br>
+      errs() << "'" << Feature<br>
+             << "' is not a recognized feature for this target"<br>
+             << " (ignoring feature)\n";<br>
     }<br>
   }<br>
<br>
<br>
Removed: llvm/trunk/test/MC/ARM/unrecognized.ll<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/ARM/unrecognized.ll?rev=200082&view=auto" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/ARM/unrecognized.ll?rev=200082&view=auto</a><br>

==============================================================================<br>
--- llvm/trunk/test/MC/ARM/unrecognized.ll (original)<br>
+++ llvm/trunk/test/MC/ARM/unrecognized.ll (removed)<br>
@@ -1,15 +0,0 @@<br>
-; RUN: llc -mcpu=invalid -o /dev/null %s 2>&1 | FileCheck %s --check-prefix=CPU<br>
-; CPU:     'invalid' is not a recognized processor for this target (ignoring processor)<br>
-; CPU-NOT: 'invalid' is not a recognized processor for this target (ignoring processor)<br>
-<br>
-; RUN: llc -mattr=+foo,+bar -o /dev/null %s 2>&1 | FileCheck %s --check-prefix=FEATURE<br>
-; FEATURE:      'foo' is not a recognized feature for this target (ignoring feature)<br>
-; FEATURE-NEXT: 'bar' is not a recognized feature for this target (ignoring feature)<br>
-; FEATURE-NOT:  'foo' is not a recognized feature for this target (ignoring feature)<br>
-; FEATURE-NOT:  'bar' is not a recognized feature for this target (ignoring feature)<br>
-<br>
-define void @foo() {<br>
-entry:<br>
-  ret void<br>
-}<br>
-<br>
<br>
<br>
_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><br>
</blockquote></div><br></div>