[PATCH] D16832: Minor performance tweaks to llvm-tblgen (and a few that might be a good idea)
Alexander Riccio via llvm-commits
llvm-commits at lists.llvm.org
Tue Feb 2 21:58:24 PST 2016
ariccio updated this revision to Diff 46740.
ariccio added a comment.
Responded to comments.
http://reviews.llvm.org/D16832
Files:
C:/LLVM/llvm/include/llvm/TableGen/Record.h
C:/LLVM/llvm/utils/TableGen/CodeGenInstruction.cpp
C:/LLVM/llvm/utils/TableGen/CodeGenTarget.cpp
Index: C:/LLVM/llvm/utils/TableGen/CodeGenInstruction.cpp
===================================================================
--- C:/LLVM/llvm/utils/TableGen/CodeGenInstruction.cpp
+++ C:/LLVM/llvm/utils/TableGen/CodeGenInstruction.cpp
@@ -49,7 +49,9 @@
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) {
Index: C:/LLVM/llvm/include/llvm/TableGen/Record.h
===================================================================
--- C:/LLVM/llvm/include/llvm/TableGen/Record.h
+++ C:/LLVM/llvm/include/llvm/TableGen/Record.h
@@ -1307,9 +1307,10 @@
}
bool isSubClassOf(StringRef Name) const {
- for (const auto &SCPair : SuperClasses)
+ for (const auto &SCPair : SuperClasses) {
if (SCPair.first->getNameInitAsString() == Name)
return true;
+ }
return false;
}
Index: C:/LLVM/llvm/utils/TableGen/CodeGenTarget.cpp
===================================================================
--- C:/LLVM/llvm/utils/TableGen/CodeGenTarget.cpp
+++ C:/LLVM/llvm/utils/TableGen/CodeGenTarget.cpp
@@ -441,14 +441,15 @@
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");
if (isTarget == TargetOnly)
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;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D16832.46740.patch
Type: text/x-patch
Size: 1930 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160203/f937ba79/attachment.bin>
More information about the llvm-commits
mailing list