[polly] 0e93f3b - [Polly] Replace use of std::stringstream. NFC.

Michael Kruse via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 9 09:36:49 PDT 2020


Author: Michael Kruse
Date: 2020-03-09T11:35:34-05:00
New Revision: 0e93f3b0a06fc470e37b5be99734f5105ba11232

URL: https://github.com/llvm/llvm-project/commit/0e93f3b0a06fc470e37b5be99734f5105ba11232
DIFF: https://github.com/llvm/llvm-project/commit/0e93f3b0a06fc470e37b5be99734f5105ba11232.diff

LOG: [Polly] Replace use of std::stringstream. NFC.

Use of std::-style (io)streams is discouraged in the LLVM coding style
(https://llvm.org/docs/CodingStandards.html#include-iostream-is-forbidden).
Replace with a use of llvm::Twine (which uses llvm::raw_ostream behind
the scenes).

Added: 
    

Modified: 
    polly/lib/CodeGen/PerfMonitor.cpp

Removed: 
    


################################################################################
diff  --git a/polly/lib/CodeGen/PerfMonitor.cpp b/polly/lib/CodeGen/PerfMonitor.cpp
index 2639e160387b..b452dc3bcc09 100644
--- a/polly/lib/CodeGen/PerfMonitor.cpp
+++ b/polly/lib/CodeGen/PerfMonitor.cpp
@@ -12,8 +12,8 @@
 #include "polly/CodeGen/RuntimeDebugBuilder.h"
 #include "polly/ScopInfo.h"
 #include "llvm/ADT/Triple.h"
+#include "llvm/ADT/Twine.h"
 #include "llvm/IR/IntrinsicsX86.h"
-#include <sstream>
 
 using namespace llvm;
 using namespace polly;
@@ -82,13 +82,12 @@ static void TryRegisterGlobal(Module *M, const char *Name,
 // Generate a unique name that is usable as a LLVM name for a scop to name its
 // performance counter.
 static std::string GetScopUniqueVarname(const Scop &S) {
-  std::stringstream Name;
   std::string EntryString, ExitString;
   std::tie(EntryString, ExitString) = S.getEntryExitStr();
 
-  Name << "__polly_perf_in_" << std::string(S.getFunction().getName())
-       << "_from__" << EntryString << "__to__" << ExitString;
-  return Name.str();
+  return (Twine("__polly_perf_in_") + S.getFunction().getName() + "_from__" +
+          EntryString + "__to__" + ExitString)
+      .str();
 }
 
 void PerfMonitor::addScopCounter() {


        


More information about the llvm-commits mailing list