diff options
author | Youngsuk Kim <youngsuk.kim@hpe.com> | 2024-09-20 12:02:24 -0500 |
---|---|---|
committer | Youngsuk Kim <youngsuk.kim@hpe.com> | 2024-09-20 12:19:59 -0500 |
commit | d31e314131b17b0a802a80593a33cb11213c60d1 (patch) | |
tree | 3c394f629c57b2bc115651c52dd8c10cc3d57a40 | |
parent | efb583178d74b2174e8b9660b67ba7295527b09f (diff) | |
download | llvm-d31e314131b17b0a802a80593a33cb11213c60d1.zip llvm-d31e314131b17b0a802a80593a33cb11213c60d1.tar.gz llvm-d31e314131b17b0a802a80593a33cb11213c60d1.tar.bz2 |
[llvm] Don't call raw_string_ostream::flush() (NFC)
Don't call raw_string_ostream::flush(), which is essentially a no-op.
As specified in the docs, raw_string_ostream is always unbuffered.
( 65b13610a5226b84889b923bae884ba395ad084d for further reference )
19 files changed, 0 insertions, 22 deletions
diff --git a/llvm/lib/Analysis/CallGraphSCCPass.cpp b/llvm/lib/Analysis/CallGraphSCCPass.cpp index ccba8b3..7caf814 100644 --- a/llvm/lib/Analysis/CallGraphSCCPass.cpp +++ b/llvm/lib/Analysis/CallGraphSCCPass.cpp @@ -453,7 +453,6 @@ bool CGPassManager::RunAllPassesOnSCC(CallGraphSCC &CurSCC, CallGraph &CG, OS << LS; CGN->print(OS); } - OS.flush(); #endif dumpPassInfo(P, EXECUTION_MSG, ON_CG_MSG, Functions); } diff --git a/llvm/lib/CodeGen/MIRPrinter.cpp b/llvm/lib/CodeGen/MIRPrinter.cpp index 6e23969..7de68b1 100644 --- a/llvm/lib/CodeGen/MIRPrinter.cpp +++ b/llvm/lib/CodeGen/MIRPrinter.cpp @@ -256,7 +256,6 @@ void MIRPrinter::print(const MachineFunction &MF) { .print(MBB); IsNewlineNeeded = true; } - StrOS.flush(); // Convert machine metadata collected during the print of the machine // function. convertMachineMetadataNodes(YamlMF, MF, MST); diff --git a/llvm/lib/DebugInfo/GSYM/DwarfTransformer.cpp b/llvm/lib/DebugInfo/GSYM/DwarfTransformer.cpp index 601686f..894abf5 100644 --- a/llvm/lib/DebugInfo/GSYM/DwarfTransformer.cpp +++ b/llvm/lib/DebugInfo/GSYM/DwarfTransformer.cpp @@ -620,7 +620,6 @@ Error DwarfTransformer::convert(uint32_t NumThreads, OutputAggregator &Out) { // Print ThreadLogStorage lines into an actual stream under a lock std::lock_guard<std::mutex> guard(LogMutex); if (Out.GetOS()) { - StrStream.flush(); Out << storage; } Out.Merge(ThreadOut); diff --git a/llvm/lib/IRReader/IRReader.cpp b/llvm/lib/IRReader/IRReader.cpp index 7885c36..a7e7dee 100644 --- a/llvm/lib/IRReader/IRReader.cpp +++ b/llvm/lib/IRReader/IRReader.cpp @@ -124,7 +124,6 @@ LLVMBool LLVMParseIRInContext(LLVMContextRef ContextRef, raw_string_ostream os(buf); Diag.print(nullptr, os, false); - os.flush(); *OutMessage = strdup(buf.c_str()); } diff --git a/llvm/lib/ObjectYAML/CodeViewYAMLSymbols.cpp b/llvm/lib/ObjectYAML/CodeViewYAMLSymbols.cpp index e1d2700..b15919f 100644 --- a/llvm/lib/ObjectYAML/CodeViewYAMLSymbols.cpp +++ b/llvm/lib/ObjectYAML/CodeViewYAMLSymbols.cpp @@ -308,7 +308,6 @@ void UnknownSymbolRecord::map(yaml::IO &io) { std::string Str; raw_string_ostream OS(Str); Binary.writeAsBinary(OS); - OS.flush(); Data.assign(Str.begin(), Str.end()); } } diff --git a/llvm/lib/TableGen/Record.cpp b/llvm/lib/TableGen/Record.cpp index ff2da3b..a72a0799 100644 --- a/llvm/lib/TableGen/Record.cpp +++ b/llvm/lib/TableGen/Record.cpp @@ -838,7 +838,6 @@ Init *UnOpInit::Fold(Record *CurRec, bool IsFinal) const { std::string S; raw_string_ostream OS(S); OS << *Def->getDef(); - OS.flush(); return StringInit::get(RK, S); } else { // Otherwise, print the value of the variable. diff --git a/llvm/lib/Target/AMDGPU/AMDGPUMCInstLower.cpp b/llvm/lib/Target/AMDGPU/AMDGPUMCInstLower.cpp index f5b5e9e..6a79aa0 100644 --- a/llvm/lib/Target/AMDGPU/AMDGPUMCInstLower.cpp +++ b/llvm/lib/Target/AMDGPU/AMDGPUMCInstLower.cpp @@ -321,7 +321,6 @@ void AMDGPUAsmPrinter::emitInstruction(const MachineInstr *MI) { HexStream << format("%s%08X", (i > 0 ? " " : ""), CodeDWord); } - DisasmStream.flush(); DisasmLineMaxLen = std::max(DisasmLineMaxLen, DisasmLine.size()); } } diff --git a/llvm/lib/Target/AMDGPU/AsmParser/AMDGPUAsmParser.cpp b/llvm/lib/Target/AMDGPU/AsmParser/AMDGPUAsmParser.cpp index f973924..728e421b 100644 --- a/llvm/lib/Target/AMDGPU/AsmParser/AMDGPUAsmParser.cpp +++ b/llvm/lib/Target/AMDGPU/AsmParser/AMDGPUAsmParser.cpp @@ -6094,7 +6094,6 @@ bool AMDGPUAsmParser::ParseToEndDirective(const char *AssemblerDirectiveBegin, Twine(AssemblerDirectiveEnd) + Twine(" not found")); } - CollectStream.flush(); return false; } diff --git a/llvm/lib/Target/AMDGPU/Utils/AMDGPUBaseInfo.cpp b/llvm/lib/Target/AMDGPU/Utils/AMDGPUBaseInfo.cpp index cda664a..8b5ec87 100644 --- a/llvm/lib/Target/AMDGPU/Utils/AMDGPUBaseInfo.cpp +++ b/llvm/lib/Target/AMDGPU/Utils/AMDGPUBaseInfo.cpp @@ -904,7 +904,6 @@ std::string AMDGPUTargetID::toString() const { StreamRep << Processor << Features; - StreamRep.flush(); return StringRep; } diff --git a/llvm/lib/Target/NVPTX/NVPTXAsmPrinter.cpp b/llvm/lib/Target/NVPTX/NVPTXAsmPrinter.cpp index d7197a7..38c5166 100644 --- a/llvm/lib/Target/NVPTX/NVPTXAsmPrinter.cpp +++ b/llvm/lib/Target/NVPTX/NVPTXAsmPrinter.cpp @@ -596,7 +596,6 @@ std::string NVPTXAsmPrinter::getVirtualRegisterName(unsigned Reg) const { NameStr << getNVPTXRegClassStr(RC) << MappedVR; - NameStr.flush(); return Name; } diff --git a/llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp b/llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp index dcde863..9528aea 100644 --- a/llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp +++ b/llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp @@ -3246,7 +3246,6 @@ static std::string convertToSinitPriority(int Priority) { std::string PrioritySuffix; llvm::raw_string_ostream os(PrioritySuffix); os << llvm::format_hex_no_prefix(P, 8); - os.flush(); return PrioritySuffix; } diff --git a/llvm/lib/Target/RISCV/RISCVInstrInfo.cpp b/llvm/lib/Target/RISCV/RISCVInstrInfo.cpp index 02f65ff..41f93fd 100644 --- a/llvm/lib/Target/RISCV/RISCVInstrInfo.cpp +++ b/llvm/lib/Target/RISCV/RISCVInstrInfo.cpp @@ -3025,7 +3025,6 @@ std::string RISCVInstrInfo::createMIROperandComment( << (Policy & RISCVII::MASK_AGNOSTIC ? "ma" : "mu"); } - OS.flush(); return Comment; } diff --git a/llvm/lib/Target/X86/X86MCInstLower.cpp b/llvm/lib/Target/X86/X86MCInstLower.cpp index b6560f1..24db39c 100644 --- a/llvm/lib/Target/X86/X86MCInstLower.cpp +++ b/llvm/lib/Target/X86/X86MCInstLower.cpp @@ -1541,7 +1541,6 @@ static std::string getShuffleComment(const MachineInstr *MI, unsigned SrcOp1Idx, printDstRegisterName(CS, MI, SrcOp1Idx); CS << " = "; printShuffleMask(CS, Src1Name, Src2Name, Mask); - CS.flush(); return Comment; } diff --git a/llvm/lib/Transforms/Instrumentation/GCOVProfiling.cpp b/llvm/lib/Transforms/Instrumentation/GCOVProfiling.cpp index 1d4f85a..694b2e6 100644 --- a/llvm/lib/Transforms/Instrumentation/GCOVProfiling.cpp +++ b/llvm/lib/Transforms/Instrumentation/GCOVProfiling.cpp @@ -340,7 +340,6 @@ namespace { std::string FunctionNameAndLine; raw_string_ostream FNLOS(FunctionNameAndLine); FNLOS << getFunctionName(SP) << SP->getLine(); - FNLOS.flush(); FuncChecksum = hash_value(FunctionNameAndLine); } diff --git a/llvm/lib/Transforms/Instrumentation/PGOInstrumentation.cpp b/llvm/lib/Transforms/Instrumentation/PGOInstrumentation.cpp index b985d5b..10442fa 100644 --- a/llvm/lib/Transforms/Instrumentation/PGOInstrumentation.cpp +++ b/llvm/lib/Transforms/Instrumentation/PGOInstrumentation.cpp @@ -404,7 +404,6 @@ static std::string getBranchCondString(Instruction *TI) { else OS << "_Const"; } - OS.flush(); return result; } @@ -2364,7 +2363,6 @@ void llvm::setProfMetadata(Module *M, Instruction *TI, raw_string_ostream OS(BranchProbStr); OS << BP; OS << " (total count : " << TotalCount << ")"; - OS.flush(); Function *F = TI->getParent()->getParent(); OptimizationRemarkEmitter ORE(F); ORE.emit([&]() { diff --git a/llvm/lib/Transforms/Scalar/ConstraintElimination.cpp b/llvm/lib/Transforms/Scalar/ConstraintElimination.cpp index 6565aed..7e2721d 100644 --- a/llvm/lib/Transforms/Scalar/ConstraintElimination.cpp +++ b/llvm/lib/Transforms/Scalar/ConstraintElimination.cpp @@ -1857,7 +1857,6 @@ static bool eliminateConstraints(Function &F, DominatorTree &DT, LoopInfo &LI, std::string S; raw_string_ostream StringS(S); ReproducerModule->print(StringS, nullptr); - StringS.flush(); OptimizationRemark Rem(DEBUG_TYPE, "Reproducer", &F); Rem << ore::NV("module") << S; ORE.emit(Rem); diff --git a/llvm/lib/Transforms/Scalar/LowerMatrixIntrinsics.cpp b/llvm/lib/Transforms/Scalar/LowerMatrixIntrinsics.cpp index 8af85d2..0d98e84 100644 --- a/llvm/lib/Transforms/Scalar/LowerMatrixIntrinsics.cpp +++ b/llvm/lib/Transforms/Scalar/LowerMatrixIntrinsics.cpp @@ -2306,7 +2306,6 @@ public: default: llvm_unreachable("Unhandled case"); } - SS.flush(); write(Tmp); } } @@ -2361,7 +2360,6 @@ public: else TmpStream << "scalar"; } - TmpStream.flush(); Tmp = std::string(StringRef(Tmp).trim()); LineLength += Tmp.size(); Stream << Tmp; @@ -2435,7 +2433,6 @@ public: } const std::string &getResult() { - Stream.flush(); return Str; } }; diff --git a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp index 806dbd5..3cf4162 100644 --- a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp +++ b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp @@ -4427,7 +4427,6 @@ void LoopVectorizationPlanner::emitInvalidCostRemarks( OS << " call to " << CalledFn->getName(); } else OS << " " << Instruction::getOpcodeName(Opcode); - OS.flush(); reportVectorizationInfo(OutString, "InvalidCost", ORE, OrigLoop, nullptr, R->getDebugLoc()); Tail = Tail.drop_front(Subset.size()); diff --git a/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp b/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp index ddeb9746..3102ed9 100644 --- a/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp +++ b/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp @@ -413,7 +413,6 @@ static std::string shortBundleName(ArrayRef<Value *> VL, int Idx = -1) { if (Idx >= 0) OS << "Idx: " << Idx << ", "; OS << "n=" << VL.size() << " [" << *VL.front() << ", ..]"; - OS.flush(); return Result; } #endif |