summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--llvm/include/llvm/TableGen/Record.h9
-rw-r--r--llvm/utils/TableGen/CodeGenInstruction.cpp4
-rw-r--r--llvm/utils/TableGen/CodeGenTarget.cpp3
3 files changed, 12 insertions, 4 deletions
diff --git a/llvm/include/llvm/TableGen/Record.h b/llvm/include/llvm/TableGen/Record.h
index 02aa7ee8b56..2069b2704a0 100644
--- a/llvm/include/llvm/TableGen/Record.h
+++ b/llvm/include/llvm/TableGen/Record.h
@@ -1307,9 +1307,14 @@ public:
}
bool isSubClassOf(StringRef Name) const {
- for (const auto &SCPair : SuperClasses)
- if (SCPair.first->getNameInitAsString() == Name)
+ for (const auto &SCPair : SuperClasses) {
+ if (const auto *SI = dyn_cast<StringInit>(SCPair.first->getNameInit())) {
+ if (SI->getValue() == Name)
+ return true;
+ } else if (SCPair.first->getNameInitAsString() == Name) {
return true;
+ }
+ }
return false;
}
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;
OpenPOWER on IntegriCloud