diff options
author | Daniel Sanders <daniel_l_sanders@apple.com> | 2017-07-04 15:31:50 +0000 |
---|---|---|
committer | Daniel Sanders <daniel_l_sanders@apple.com> | 2017-07-04 15:31:50 +0000 |
commit | c60abe37f29f8be7b4cf8cea0001dadfe1f74a1d (patch) | |
tree | 2112d1d9ae85696c7ce5020469fdd3ecba2b7e2f | |
parent | 37a7f91005a2e4b04a31ac1ec6a4ac3d518bd320 (diff) | |
download | bcm5719-llvm-c60abe37f29f8be7b4cf8cea0001dadfe1f74a1d.tar.gz bcm5719-llvm-c60abe37f29f8be7b4cf8cea0001dadfe1f74a1d.zip |
[globalisel][tablegen] Fix release builds after r307079
Using NumPatternEmitted as a unique id for the tables is not valid on release
builds since the counters don't count in that case.
Also fix an unused variable warning.
llvm-svn: 307088
-rw-r--r-- | llvm/include/llvm/CodeGen/GlobalISel/InstructionSelectorImpl.h | 2 | ||||
-rw-r--r-- | llvm/utils/TableGen/GlobalISelEmitter.cpp | 9 |
2 files changed, 8 insertions, 3 deletions
diff --git a/llvm/include/llvm/CodeGen/GlobalISel/InstructionSelectorImpl.h b/llvm/include/llvm/CodeGen/GlobalISel/InstructionSelectorImpl.h index 578b0943e64..5020f6e3df4 100644 --- a/llvm/include/llvm/CodeGen/GlobalISel/InstructionSelectorImpl.h +++ b/llvm/include/llvm/CodeGen/GlobalISel/InstructionSelectorImpl.h @@ -29,7 +29,7 @@ bool InstructionSelector::executeMatchTable( while (true) { switch (*Command++) { case GIM_RecordInsn: { - int64_t NewInsnID = *Command++; + int64_t NewInsnID LLVM_ATTRIBUTE_UNUSED = *Command++; int64_t InsnID = *Command++; int64_t OpIdx = *Command++; diff --git a/llvm/utils/TableGen/GlobalISelEmitter.cpp b/llvm/utils/TableGen/GlobalISelEmitter.cpp index 0a43337e606..387b797c84d 100644 --- a/llvm/utils/TableGen/GlobalISelEmitter.cpp +++ b/llvm/utils/TableGen/GlobalISelEmitter.cpp @@ -53,6 +53,8 @@ STATISTIC(NumPatternTotal, "Total number of patterns"); STATISTIC(NumPatternImported, "Number of patterns imported from SelectionDAG"); STATISTIC(NumPatternImportsSkipped, "Number of SelectionDAG imports skipped"); STATISTIC(NumPatternEmitted, "Number of patterns emitted"); +/// A unique identifier for a MatchTable. +static unsigned CurrentMatchTableID = 0; cl::OptionCategory GlobalISelEmitterCat("Options for -gen-global-isel"); @@ -1269,7 +1271,7 @@ void RuleMatcher::emit(raw_ostream &OS) { // on some targets but we don't need to make use of that yet. assert(Matchers.size() == 1 && "Cannot handle multi-root matchers yet"); - OS << " const static int64_t MatchTable" << NumPatternEmitted << "[] = {\n"; + OS << " const static int64_t MatchTable" << CurrentMatchTableID << "[] = {\n"; if (!RequiredFeatures.empty()) { OS << " GIM_CheckFeatures, " << getNameForFeatureBitset(RequiredFeatures) << ",\n"; @@ -1286,7 +1288,7 @@ void RuleMatcher::emit(raw_ostream &OS) { << " State.MIs.clear();\n" << " State.MIs.push_back(&I);\n" << " if (executeMatchTable(*this, State, MatcherInfo, MatchTable" - << NumPatternEmitted << ", MRI, TRI, RBI, AvailableFeatures)) {\n"; + << CurrentMatchTableID << ", MRI, TRI, RBI, AvailableFeatures)) {\n"; // We must also check if it's safe to fold the matched instructions. if (InsnVariableIDs.size() >= 2) { @@ -2171,7 +2173,10 @@ void GlobalISelEmitter::run(raw_ostream &OS) { for (auto &Rule : Rules) { Rule.emit(OS); + ++CurrentMatchTableID; ++NumPatternEmitted; + assert(CurrentMatchTableID == NumPatternEmitted && + "Statistic deviates from number of emitted tables"); } OS << " return false;\n" |