[llvm] r288655 - TableGen/AsmMatcherEmitter: Trust that stable_sort works

Matthias Braun via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 5 00:15:57 PST 2016


Author: matze
Date: Mon Dec  5 02:15:57 2016
New Revision: 288655

URL: http://llvm.org/viewvc/llvm-project?rev=288655&view=rev
Log:
TableGen/AsmMatcherEmitter: Trust that stable_sort works

A debug build of AsmMatcherEmitter would use a quadratic algorithm to
check whether std::stable_sort() actually sorted. Let's hope the authors
of our C++ standard library did that testing for us. Removing the check
gives a 3x speedup in the X86 case.

Modified:
    llvm/trunk/utils/TableGen/AsmMatcherEmitter.cpp

Modified: llvm/trunk/utils/TableGen/AsmMatcherEmitter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/AsmMatcherEmitter.cpp?rev=288655&r1=288654&r2=288655&view=diff
==============================================================================
--- llvm/trunk/utils/TableGen/AsmMatcherEmitter.cpp (original)
+++ llvm/trunk/utils/TableGen/AsmMatcherEmitter.cpp Mon Dec  5 02:15:57 2016
@@ -2719,16 +2719,6 @@ void AsmMatcherEmitter::run(raw_ostream
                       const std::unique_ptr<MatchableInfo> &b){
                      return *a < *b;});
 
-#ifndef NDEBUG
-  // Verify that the table is now sorted
-  for (auto I = Info.Matchables.begin(), E = Info.Matchables.end(); I != E;
-       ++I) {
-    for (auto J = I; J != E; ++J) {
-      assert(!(**J < **I));
-    }
-  }
-#endif // NDEBUG
-
   DEBUG_WITH_TYPE("instruction_info", {
       for (const auto &MI : Info.Matchables)
         MI->dump();




More information about the llvm-commits mailing list