From: Volkan Keles Date: Thu, 25 Jan 2018 00:18:52 +0000 (+0000) Subject: [GlobalISel][TableGen] Fix the statistics for emitted patters X-Git-Tag: android-x86-7.1-r4~5874 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=542224fdbbb39fbab8af6530d26e3e170c9b5c38;p=android-x86%2Fexternal-llvm.git [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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@323391 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/utils/TableGen/GlobalISelEmitter.cpp b/utils/TableGen/GlobalISelEmitter.cpp index b350618e5ab..865a01a868e 100644 --- a/utils/TableGen/GlobalISelEmitter.cpp +++ b/utils/TableGen/GlobalISelEmitter.cpp @@ -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 &OS) { : 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, ";