Skip to content

Commit d31e314

Browse files
committed
[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. ( 65b1361 for further reference )
1 parent efb5831 commit d31e314

19 files changed

+0
-22
lines changed

llvm/lib/Analysis/CallGraphSCCPass.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -453,7 +453,6 @@ bool CGPassManager::RunAllPassesOnSCC(CallGraphSCC &CurSCC, CallGraph &CG,
453453
OS << LS;
454454
CGN->print(OS);
455455
}
456-
OS.flush();
457456
#endif
458457
dumpPassInfo(P, EXECUTION_MSG, ON_CG_MSG, Functions);
459458
}

llvm/lib/CodeGen/MIRPrinter.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,6 @@ void MIRPrinter::print(const MachineFunction &MF) {
256256
.print(MBB);
257257
IsNewlineNeeded = true;
258258
}
259-
StrOS.flush();
260259
// Convert machine metadata collected during the print of the machine
261260
// function.
262261
convertMachineMetadataNodes(YamlMF, MF, MST);

llvm/lib/DebugInfo/GSYM/DwarfTransformer.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -620,7 +620,6 @@ Error DwarfTransformer::convert(uint32_t NumThreads, OutputAggregator &Out) {
620620
// Print ThreadLogStorage lines into an actual stream under a lock
621621
std::lock_guard<std::mutex> guard(LogMutex);
622622
if (Out.GetOS()) {
623-
StrStream.flush();
624623
Out << storage;
625624
}
626625
Out.Merge(ThreadOut);

llvm/lib/IRReader/IRReader.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,6 @@ LLVMBool LLVMParseIRInContext(LLVMContextRef ContextRef,
124124
raw_string_ostream os(buf);
125125

126126
Diag.print(nullptr, os, false);
127-
os.flush();
128127

129128
*OutMessage = strdup(buf.c_str());
130129
}

llvm/lib/ObjectYAML/CodeViewYAMLSymbols.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,6 @@ void UnknownSymbolRecord::map(yaml::IO &io) {
308308
std::string Str;
309309
raw_string_ostream OS(Str);
310310
Binary.writeAsBinary(OS);
311-
OS.flush();
312311
Data.assign(Str.begin(), Str.end());
313312
}
314313
}

llvm/lib/TableGen/Record.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -838,7 +838,6 @@ Init *UnOpInit::Fold(Record *CurRec, bool IsFinal) const {
838838
std::string S;
839839
raw_string_ostream OS(S);
840840
OS << *Def->getDef();
841-
OS.flush();
842841
return StringInit::get(RK, S);
843842
} else {
844843
// Otherwise, print the value of the variable.

llvm/lib/Target/AMDGPU/AMDGPUMCInstLower.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,6 @@ void AMDGPUAsmPrinter::emitInstruction(const MachineInstr *MI) {
321321
HexStream << format("%s%08X", (i > 0 ? " " : ""), CodeDWord);
322322
}
323323

324-
DisasmStream.flush();
325324
DisasmLineMaxLen = std::max(DisasmLineMaxLen, DisasmLine.size());
326325
}
327326
}

llvm/lib/Target/AMDGPU/AsmParser/AMDGPUAsmParser.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6094,7 +6094,6 @@ bool AMDGPUAsmParser::ParseToEndDirective(const char *AssemblerDirectiveBegin,
60946094
Twine(AssemblerDirectiveEnd) + Twine(" not found"));
60956095
}
60966096

6097-
CollectStream.flush();
60986097
return false;
60996098
}
61006099

llvm/lib/Target/AMDGPU/Utils/AMDGPUBaseInfo.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -904,7 +904,6 @@ std::string AMDGPUTargetID::toString() const {
904904

905905
StreamRep << Processor << Features;
906906

907-
StreamRep.flush();
908907
return StringRep;
909908
}
910909

llvm/lib/Target/NVPTX/NVPTXAsmPrinter.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -596,7 +596,6 @@ std::string NVPTXAsmPrinter::getVirtualRegisterName(unsigned Reg) const {
596596

597597
NameStr << getNVPTXRegClassStr(RC) << MappedVR;
598598

599-
NameStr.flush();
600599
return Name;
601600
}
602601

llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3246,7 +3246,6 @@ static std::string convertToSinitPriority(int Priority) {
32463246
std::string PrioritySuffix;
32473247
llvm::raw_string_ostream os(PrioritySuffix);
32483248
os << llvm::format_hex_no_prefix(P, 8);
3249-
os.flush();
32503249
return PrioritySuffix;
32513250
}
32523251

llvm/lib/Target/RISCV/RISCVInstrInfo.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3025,7 +3025,6 @@ std::string RISCVInstrInfo::createMIROperandComment(
30253025
<< (Policy & RISCVII::MASK_AGNOSTIC ? "ma" : "mu");
30263026
}
30273027

3028-
OS.flush();
30293028
return Comment;
30303029
}
30313030

llvm/lib/Target/X86/X86MCInstLower.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1541,7 +1541,6 @@ static std::string getShuffleComment(const MachineInstr *MI, unsigned SrcOp1Idx,
15411541
printDstRegisterName(CS, MI, SrcOp1Idx);
15421542
CS << " = ";
15431543
printShuffleMask(CS, Src1Name, Src2Name, Mask);
1544-
CS.flush();
15451544

15461545
return Comment;
15471546
}

llvm/lib/Transforms/Instrumentation/GCOVProfiling.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,6 @@ namespace {
340340
std::string FunctionNameAndLine;
341341
raw_string_ostream FNLOS(FunctionNameAndLine);
342342
FNLOS << getFunctionName(SP) << SP->getLine();
343-
FNLOS.flush();
344343
FuncChecksum = hash_value(FunctionNameAndLine);
345344
}
346345

llvm/lib/Transforms/Instrumentation/PGOInstrumentation.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -404,7 +404,6 @@ static std::string getBranchCondString(Instruction *TI) {
404404
else
405405
OS << "_Const";
406406
}
407-
OS.flush();
408407
return result;
409408
}
410409

@@ -2364,7 +2363,6 @@ void llvm::setProfMetadata(Module *M, Instruction *TI,
23642363
raw_string_ostream OS(BranchProbStr);
23652364
OS << BP;
23662365
OS << " (total count : " << TotalCount << ")";
2367-
OS.flush();
23682366
Function *F = TI->getParent()->getParent();
23692367
OptimizationRemarkEmitter ORE(F);
23702368
ORE.emit([&]() {

llvm/lib/Transforms/Scalar/ConstraintElimination.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1857,7 +1857,6 @@ static bool eliminateConstraints(Function &F, DominatorTree &DT, LoopInfo &LI,
18571857
std::string S;
18581858
raw_string_ostream StringS(S);
18591859
ReproducerModule->print(StringS, nullptr);
1860-
StringS.flush();
18611860
OptimizationRemark Rem(DEBUG_TYPE, "Reproducer", &F);
18621861
Rem << ore::NV("module") << S;
18631862
ORE.emit(Rem);

llvm/lib/Transforms/Scalar/LowerMatrixIntrinsics.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2306,7 +2306,6 @@ class LowerMatrixIntrinsics {
23062306
default:
23072307
llvm_unreachable("Unhandled case");
23082308
}
2309-
SS.flush();
23102309
write(Tmp);
23112310
}
23122311
}
@@ -2361,7 +2360,6 @@ class LowerMatrixIntrinsics {
23612360
else
23622361
TmpStream << "scalar";
23632362
}
2364-
TmpStream.flush();
23652363
Tmp = std::string(StringRef(Tmp).trim());
23662364
LineLength += Tmp.size();
23672365
Stream << Tmp;
@@ -2435,7 +2433,6 @@ class LowerMatrixIntrinsics {
24352433
}
24362434

24372435
const std::string &getResult() {
2438-
Stream.flush();
24392436
return Str;
24402437
}
24412438
};

llvm/lib/Transforms/Vectorize/LoopVectorize.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4427,7 +4427,6 @@ void LoopVectorizationPlanner::emitInvalidCostRemarks(
44274427
OS << " call to " << CalledFn->getName();
44284428
} else
44294429
OS << " " << Instruction::getOpcodeName(Opcode);
4430-
OS.flush();
44314430
reportVectorizationInfo(OutString, "InvalidCost", ORE, OrigLoop, nullptr,
44324431
R->getDebugLoc());
44334432
Tail = Tail.drop_front(Subset.size());

llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -413,7 +413,6 @@ static std::string shortBundleName(ArrayRef<Value *> VL, int Idx = -1) {
413413
if (Idx >= 0)
414414
OS << "Idx: " << Idx << ", ";
415415
OS << "n=" << VL.size() << " [" << *VL.front() << ", ..]";
416-
OS.flush();
417416
return Result;
418417
}
419418
#endif

0 commit comments

Comments
 (0)