diff options
author | Alp Toker <alp@nuanti.com> | 2014-06-26 22:52:05 +0000 |
---|---|---|
committer | Alp Toker <alp@nuanti.com> | 2014-06-26 22:52:05 +0000 |
commit | 8dd8d5c2b2ad0f9dd1ca01c0a7d8ebac57b8537d (patch) | |
tree | 7da91c52380a71a92a895b0c172ae28b83fb6011 /lib/Transforms/Vectorize | |
parent | eca517deaa890b1658ed0452704f398ce80e47b8 (diff) | |
download | llvm-8dd8d5c2b2ad0f9dd1ca01c0a7d8ebac57b8537d.tar.gz llvm-8dd8d5c2b2ad0f9dd1ca01c0a7d8ebac57b8537d.tar.bz2 llvm-8dd8d5c2b2ad0f9dd1ca01c0a7d8ebac57b8537d.tar.xz |
Revert "Introduce a string_ostream string builder facilty"
Temporarily back out commits r211749, r211752 and r211754.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@211814 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/Vectorize')
-rw-r--r-- | lib/Transforms/Vectorize/LoopVectorize.cpp | 36 |
1 files changed, 19 insertions, 17 deletions
diff --git a/lib/Transforms/Vectorize/LoopVectorize.cpp b/lib/Transforms/Vectorize/LoopVectorize.cpp index 2338d296cc..cb8a41dbea 100644 --- a/lib/Transforms/Vectorize/LoopVectorize.cpp +++ b/lib/Transforms/Vectorize/LoopVectorize.cpp @@ -212,23 +212,24 @@ class LoopVectorizationCostModel; /// Optimization analysis message produced during vectorization. Messages inform /// the user why vectorization did not occur. class Report { - string_ostream Message; + std::string Message; + raw_string_ostream Out; Instruction *Instr; public: - Report(Instruction *I = nullptr) : Instr(I) { - Message << "loop not vectorized: "; + Report(Instruction *I = nullptr) : Out(Message), Instr(I) { + Out << "loop not vectorized: "; } template <typename A> Report &operator<<(const A &Value) { - Message << Value; + Out << Value; return *this; } Instruction *getInstr() { return Instr; } - StringRef str() { return Message.str(); } - operator Twine() { return Message.str(); } + std::string &str() { return Out.str(); } + operator Twine() { return Out.str(); } }; /// InnerLoopVectorizer vectorizes loops which contain only one basic @@ -502,17 +503,18 @@ static void setDebugLocFromInst(IRBuilder<> &B, const Value *Ptr) { #ifndef NDEBUG /// \return string containing a file name and a line # for the given loop. static std::string getDebugLocString(const Loop *L) { - if (!L) - return std::string(); - - string_ostream OS; - const DebugLoc LoopDbgLoc = L->getStartLoc(); - if (!LoopDbgLoc.isUnknown()) - LoopDbgLoc.print(L->getHeader()->getContext(), OS); - else - // Just print the module name. - OS << L->getHeader()->getParent()->getParent()->getModuleIdentifier(); - return OS.str(); + std::string Result; + if (L) { + raw_string_ostream OS(Result); + const DebugLoc LoopDbgLoc = L->getStartLoc(); + if (!LoopDbgLoc.isUnknown()) + LoopDbgLoc.print(L->getHeader()->getContext(), OS); + else + // Just print the module name. + OS << L->getHeader()->getParent()->getParent()->getModuleIdentifier(); + OS.flush(); + } + return Result; } #endif |