[llvm] r323391 - [GlobalISel][TableGen] Fix the statistics for emitted patters

Volkan Keles via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 24 16:18:52 PST 2018


Author: volkan
Date: Wed Jan 24 16:18:52 2018
New Revision: 323391

URL: http://llvm.org/viewvc/llvm-project?rev=323391&view=rev
Log:
[GlobalISel][TableGen] Fix the statistics for emitted patters

Collected statistics for the number of patterns emitted can be
incorrect because rules can be grouped if OptimizeMatchTable
is enabled. Increase the counter in RuleMatcher::emit(...)
to avoid that.

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

Modified: llvm/trunk/utils/TableGen/GlobalISelEmitter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/GlobalISelEmitter.cpp?rev=323391&r1=323390&r2=323391&view=diff
==============================================================================
--- llvm/trunk/utils/TableGen/GlobalISelEmitter.cpp (original)
+++ llvm/trunk/utils/TableGen/GlobalISelEmitter.cpp Wed Jan 24 16:18:52 2018
@@ -2488,6 +2488,7 @@ void RuleMatcher::emit(MatchTable &Table
 
   Table << MatchTable::Opcode("GIR_Done", -1) << MatchTable::LineBreak
         << MatchTable::Label(LabelID);
+  ++NumPatternEmitted;
 }
 
 bool RuleMatcher::isHigherPriorityThan(const RuleMatcher &B) const {
@@ -3949,10 +3950,9 @@ void GlobalISelEmitter::run(raw_ostream
                          : InputRules;
 
   MatchTable Table(0);
-  for (Matcher *Rule : OptRules) {
+  for (Matcher *Rule : OptRules)
     Rule->emit(Table);
-    ++NumPatternEmitted;
-  }
+
   Table << MatchTable::Opcode("GIM_Reject") << MatchTable::LineBreak;
   Table.emitDeclaration(OS);
   OS << "  if (executeMatchTable(*this, OutMIs, State, ISelInfo, ";




More information about the llvm-commits mailing list