[SchedModel] Avoid std::string creation for instregex patterns that don't contain regex metas. NFCI.
llvm-svn: 328436
diff --git a/llvm/utils/TableGen/CodeGenSchedule.cpp b/llvm/utils/TableGen/CodeGenSchedule.cpp
index 1b516c1..b73e076 100644
--- a/llvm/utils/TableGen/CodeGenSchedule.cpp
+++ b/llvm/utils/TableGen/CodeGenSchedule.cpp
@@ -95,9 +95,10 @@
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(), ')');