[PATCH] D54382: [llvm-exegesis] Analysis::writeSnippet(): be smarter about memory allocations.

Phabricator via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 19 05:31:03 PST 2018


This revision was automatically updated to reflect the committed changes.
Closed by commit rL347198: [llvm-exegesis] Analysis::writeSnippet(): be smarter about memory allocations. (authored by lebedevri, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D54382?vs=173527&id=174593#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D54382

Files:
  llvm/trunk/tools/llvm-exegesis/lib/Analysis.cpp


Index: llvm/trunk/tools/llvm-exegesis/lib/Analysis.cpp
===================================================================
--- llvm/trunk/tools/llvm-exegesis/lib/Analysis.cpp
+++ llvm/trunk/tools/llvm-exegesis/lib/Analysis.cpp
@@ -114,13 +114,11 @@
       writeEscaped<Tag>(OS, "[error decoding asm snippet]");
       return;
     }
-    Lines.emplace_back();
-    std::string &Line = Lines.back();
-    llvm::raw_string_ostream OSS(Line);
+    llvm::SmallString<128> InstPrinterStr; // FIXME: magic number.
+    llvm::raw_svector_ostream OSS(InstPrinterStr);
     InstPrinter_->printInst(&MI, OSS, "", *SubtargetInfo_);
     Bytes = Bytes.drop_front(MISize);
-    OSS.flush();
-    Line = llvm::StringRef(Line).trim().str();
+    Lines.emplace_back(llvm::StringRef(InstPrinterStr).trim());
   }
   writeEscaped<Tag>(OS, llvm::join(Lines, Separator));
 }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D54382.174593.patch
Type: text/x-patch
Size: 855 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20181119/2e6e294f/attachment.bin>


More information about the llvm-commits mailing list