[TableGen] Use SmallString instead of std::string to build up a string to avoid heap...
authorCraig Topper <craig.topper@gmail.com>
Sat, 28 Nov 2015 08:23:02 +0000 (08:23 +0000)
committerCraig Topper <craig.topper@gmail.com>
Sat, 28 Nov 2015 08:23:02 +0000 (08:23 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254221 91177308-0d34-0410-b5e6-96231b3b80d8

utils/TableGen/CodeGenDAGPatterns.cpp

index 6ba4a8d..3f74a99 100644 (file)
@@ -14,6 +14,7 @@
 
 #include "CodeGenDAGPatterns.h"
 #include "llvm/ADT/STLExtras.h"
 
 #include "CodeGenDAGPatterns.h"
 #include "llvm/ADT/STLExtras.h"
+#include "llvm/ADT/SmallString.h"
 #include "llvm/ADT/StringExtras.h"
 #include "llvm/ADT/Twine.h"
 #include "llvm/Support/Debug.h"
 #include "llvm/ADT/StringExtras.h"
 #include "llvm/ADT/Twine.h"
 #include "llvm/Support/Debug.h"
@@ -873,14 +874,14 @@ std::string PatternToMatch::getPredicateCheck() const {
   // Sort so that different orders get canonicalized to the same string.
   std::sort(PredicateRecs.begin(), PredicateRecs.end(), LessRecord());
 
   // Sort so that different orders get canonicalized to the same string.
   std::sort(PredicateRecs.begin(), PredicateRecs.end(), LessRecord());
 
-  std::string PredicateCheck;
+  SmallString<128> PredicateCheck;
   for (Record *Pred : PredicateRecs) {
     if (!PredicateCheck.empty())
       PredicateCheck += " && ";
     PredicateCheck += "(" + Pred->getValueAsString("CondString") + ")";
   }
 
   for (Record *Pred : PredicateRecs) {
     if (!PredicateCheck.empty())
       PredicateCheck += " && ";
     PredicateCheck += "(" + Pred->getValueAsString("CondString") + ")";
   }
 
-  return PredicateCheck;
+  return PredicateCheck.str();
 }
 
 //===----------------------------------------------------------------------===//
 }
 
 //===----------------------------------------------------------------------===//