diff options
| author | Reid Kleckner <rnk@google.com> | 2016-02-03 19:34:28 +0000 |
|---|---|---|
| committer | Reid Kleckner <rnk@google.com> | 2016-02-03 19:34:28 +0000 |
| commit | 45b6159ed34dd4ce6e58ac67d66044b057d9001f (patch) | |
| tree | 43058b5501437557d70d25d988b6e78dda579980 /llvm/utils | |
| parent | f42ef3efcad9095920232a0a710a80c5c4720170 (diff) | |
| download | bcm5719-llvm-45b6159ed34dd4ce6e58ac67d66044b057d9001f.tar.gz bcm5719-llvm-45b6159ed34dd4ce6e58ac67d66044b057d9001f.zip | |
Minor performance tweaks to llvm-tblgen (and a few that might be a good idea)
Summary:
This patch adds a reserve call to an expensive function
(`llvm::LoadIntrinsics`), and may fix a few other low hanging
performance fruit (I've put them in comments for now, so we can
discuss).
**Motivation:**
As I'm sure other developers do, when I build LLVM, I build the entire
project with the same config (`Debug`, `MinSizeRel`, `Release`, or
`RelWithDebInfo`). However, the `Debug` config also builds llvm-tblgen
in `Debug` mode. Later build steps that run llvm-tblgen then can
actually be the slowest steps in the entire build. Nobody likes slow
builds.
Reviewers: rnk, dblaikie
Differential Revision: http://reviews.llvm.org/D16832
Patch by Alexander G. Riccio
llvm-svn: 259683
Diffstat (limited to 'llvm/utils')
| -rw-r--r-- | llvm/utils/TableGen/CodeGenInstruction.cpp | 4 | ||||
| -rw-r--r-- | llvm/utils/TableGen/CodeGenTarget.cpp | 3 |
2 files changed, 5 insertions, 2 deletions
diff --git a/llvm/utils/TableGen/CodeGenInstruction.cpp b/llvm/utils/TableGen/CodeGenInstruction.cpp index 366e8ec7fac..bd26beb3567 100644 --- a/llvm/utils/TableGen/CodeGenInstruction.cpp +++ b/llvm/utils/TableGen/CodeGenInstruction.cpp @@ -49,7 +49,9 @@ CGIOperandList::CGIOperandList(Record *R) : TheDef(R) { unsigned MIOperandNo = 0; std::set<std::string> OperandNames; - for (unsigned i = 0, e = InDI->getNumArgs()+OutDI->getNumArgs(); i != e; ++i){ + unsigned e = InDI->getNumArgs() + OutDI->getNumArgs(); + OperandList.reserve(e); + for (unsigned i = 0; i != e; ++i){ Init *ArgInit; std::string ArgName; if (i < NumDefs) { diff --git a/llvm/utils/TableGen/CodeGenTarget.cpp b/llvm/utils/TableGen/CodeGenTarget.cpp index 7c2c60147ca..66ba73c592f 100644 --- a/llvm/utils/TableGen/CodeGenTarget.cpp +++ b/llvm/utils/TableGen/CodeGenTarget.cpp @@ -441,6 +441,7 @@ std::vector<CodeGenIntrinsic> llvm::LoadIntrinsics(const RecordKeeper &RC, std::vector<Record*> I = RC.getAllDerivedDefinitions("Intrinsic"); std::vector<CodeGenIntrinsic> Result; + Result.reserve(I.size()); for (unsigned i = 0, e = I.size(); i != e; ++i) { bool isTarget = I[i]->getValueAsBit("isTarget"); @@ -448,7 +449,7 @@ std::vector<CodeGenIntrinsic> llvm::LoadIntrinsics(const RecordKeeper &RC, Result.push_back(CodeGenIntrinsic(I[i])); } std::sort(Result.begin(), Result.end(), - [](CodeGenIntrinsic LHS, CodeGenIntrinsic RHS) { + [](const CodeGenIntrinsic& LHS, const CodeGenIntrinsic& RHS) { return LHS.Name < RHS.Name; }); return Result; |

