diff options
author | Roman Tereshin <rtereshin@apple.com> | 2018-05-23 02:04:19 +0000 |
---|---|---|
committer | Roman Tereshin <rtereshin@apple.com> | 2018-05-23 02:04:19 +0000 |
commit | fedae33efacbe9e1cc86b92a6e83f70125a8e338 (patch) | |
tree | fe541e84c3dafdf8bd683edaf0fc42e7878dff1b /llvm/utils/TableGen/GlobalISelEmitter.cpp | |
parent | 11dc7fcae2d112c67ebd5b12e0080f088c947054 (diff) | |
download | bcm5719-llvm-fedae33efacbe9e1cc86b92a6e83f70125a8e338.tar.gz bcm5719-llvm-fedae33efacbe9e1cc86b92a6e83f70125a8e338.zip |
[GlobalISel][InstructionSelect] MatchTable second level grouping, perf patch 5
This patch continues a series of patches started by r332907 (reapplied
as r332917)
In this commit we start grouping rules with common first condition on
the second level of the table.
This is expected to decrease time GlobalISel spends in its
InstructionSelect pass by roughly 13% for an -O0 build as measured on
sqlite3-amalgamation (http://sqlite.org/download.html) targeting
AArch64.
Reviewers: qcolombet, dsanders, bogner, aemerson, javed.absar
Reviewed By: qcolombet
Subscribers: rovka, llvm-commits, kristof.beyls
Differential Revision: https://reviews.llvm.org/D44700
llvm-svn: 333053
Diffstat (limited to 'llvm/utils/TableGen/GlobalISelEmitter.cpp')
-rw-r--r-- | llvm/utils/TableGen/GlobalISelEmitter.cpp | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/llvm/utils/TableGen/GlobalISelEmitter.cpp b/llvm/utils/TableGen/GlobalISelEmitter.cpp index ddeaf8107e6..cf0854b608e 100644 --- a/llvm/utils/TableGen/GlobalISelEmitter.cpp +++ b/llvm/utils/TableGen/GlobalISelEmitter.cpp @@ -673,7 +673,7 @@ public: /// finalize() and optimize() are both allowed to mutate the contained /// matchers, so moving them out after finalize() is not supported. void finalize(); - void optimize() override {} + void optimize() override; void emit(MatchTable &Table) override; /// Could be used to move out the matchers added previously, unless finalize() @@ -2041,6 +2041,14 @@ void InstructionMatcher::optimize() { Stash.emplace_back( new InstructionNumOperandsMatcher(InsnVarID, getNumOperands())); NumOperandsCheck = false; + + for (auto &OM : Operands) + for (auto &OP : OM->predicates()) + if (isa<IntrinsicIDOperandMatcher>(OP)) { + Stash.push_back(std::move(OP)); + OM->eraseNullPredicates(); + break; + } } if (InsnVarID > 0) { @@ -4104,6 +4112,11 @@ GlobalISelEmitter::buildMatchTable(MutableArrayRef<RuleMatcher> Rules, return MatchTable::buildTable(OptRules, WithCoverage); } +void GroupMatcher::optimize() { + GlobalISelEmitter::optimizeRules<GroupMatcher>(Matchers, MatcherStorage) + .swap(Matchers); +} + void GlobalISelEmitter::run(raw_ostream &OS) { if (!UseCoverageFile.empty()) { RuleCoverage = CodeGenCoverage(); |