summaryrefslogtreecommitdiffstats
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
commit34d512ec1e5d8fb8cf4cb72734c82a31988f5c8a (patch)
treeedbb08b60db3b0a5b7a8d7eff7ef19e1a5c9140f
parent31a96337249054680d6bff0d27f17417e1ddb3d3 (diff)
downloadbcm5719-llvm-34d512ec1e5d8fb8cf4cb72734c82a31988f5c8a.tar.gz
bcm5719-llvm-34d512ec1e5d8fb8cf4cb72734c82a31988f5c8a.zip
[SchedModel] Avoid std::string creation for instregex patterns that don't contain regex metas. NFCI.
llvm-svn: 328436
-rw-r--r--llvm/utils/TableGen/CodeGenSchedule.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/llvm/utils/TableGen/CodeGenSchedule.cpp b/llvm/utils/TableGen/CodeGenSchedule.cpp
index 1b516c17530..b73e0767e3b 100644
--- a/llvm/utils/TableGen/CodeGenSchedule.cpp
+++ b/llvm/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(), ')');
OpenPOWER on IntegriCloud