[llvm] r328436 - [SchedModel] Avoid std::string creation for instregex patterns that don't contain regex metas. NFCI.

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Sat Mar 24 14:04:20 PDT 2018


Author: rksimon
Date: Sat Mar 24 14:04:20 2018
New Revision: 328436

URL: http://llvm.org/viewvc/llvm-project?rev=328436&view=rev
Log:
[SchedModel] Avoid std::string creation for instregex patterns that don't contain regex metas. NFCI.

Modified:
    llvm/trunk/utils/TableGen/CodeGenSchedule.cpp

Modified: llvm/trunk/utils/TableGen/CodeGenSchedule.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/CodeGenSchedule.cpp?rev=328436&r1=328435&r2=328436&view=diff
==============================================================================
--- llvm/trunk/utils/TableGen/CodeGenSchedule.cpp (original)
+++ llvm/trunk/utils/TableGen/CodeGenSchedule.cpp Sat Mar 24 14:04:20 2018
@@ -95,9 +95,10 @@ struct InstRegexOp : public SetTheory::O
 
       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(), ')');




More information about the llvm-commits mailing list