aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Pilgrim <llvm-dev@redking.me.uk>2018-03-24 21:04:20 +0000
committerSimon Pilgrim <llvm-dev@redking.me.uk>2018-03-24 21:04:20 +0000
commit79483b2bf49729363ca18014ba7e1e9dfc4e4f9a (patch)
treec9acb296951283d0ca7f9ec85ae00852c667de98
parent9a7f9fe9d616a5e72e0fde51a1af2c7742f8c7ad (diff)
[SchedModel] Avoid std::string creation for instregex patterns that don't contain regex metas. NFCI.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@328436 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--utils/TableGen/CodeGenSchedule.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/utils/TableGen/CodeGenSchedule.cpp b/utils/TableGen/CodeGenSchedule.cpp
index 1b516c17530..b73e0767e3b 100644
--- a/utils/TableGen/CodeGenSchedule.cpp
+++ b/utils/TableGen/CodeGenSchedule.cpp
@@ -95,9 +95,10 @@ struct InstRegexOp : public SetTheory::Operator {
Optional<Regex> Regexpr = None;
StringRef Prefix = Original.substr(0, FirstMeta);
- std::string pat = Original.substr(FirstMeta);
- if (!pat.empty()) {
+ StringRef PatStr = Original.substr(FirstMeta);
+ if (!PatStr.empty()) {
// For the rest use a python-style prefix match.
+ std::string pat = PatStr;
if (pat[0] != '^') {
pat.insert(0, "^(");
pat.insert(pat.end(), ')');