[mlir] Don't call llvm::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 )
This commit is contained in:
Youngsuk Kim 2024-09-22 15:36:46 -05:00
parent 5a68ac8ba7
commit 123e8c735d
7 changed files with 0 additions and 24 deletions

View File

@ -495,7 +495,6 @@ static std::string buildMmaSparseAsmConstraintString(unsigned matASize,
// The final operand is for the sparsity metadata.
// The sparsity selector appears as direct literal.
ss << "r";
ss.flush();
return str;
}
@ -535,7 +534,6 @@ static std::string buildMmaSparseAsmString(
ss << "$" << asmArgIdx++ << ",";
assert(metaDataSelector <= 1);
ss << "0x" << metaDataSelector << ";";
ss.flush();
return asmStr;
}

View File

@ -99,14 +99,12 @@ void PtxBuilder::insertValue(Value v, PTXRegisterMod itype) {
} else {
ss << getModifier() << getRegisterType(t) << ",";
}
ss.flush();
}
return;
}
// Handle Scalars
addValue(v);
ss << getModifier() << getRegisterType(v) << ",";
ss.flush();
}
LLVM::InlineAsmOp PtxBuilder::build() {

View File

@ -111,7 +111,6 @@ void transform::TransformDialect::reportDuplicateTypeRegistration(
llvm::raw_string_ostream msg(buffer);
msg << "extensible dialect type '" << mnemonic
<< "' is already registered with a different implementation";
msg.flush();
llvm::report_fatal_error(StringRef(buffer));
}
@ -121,7 +120,6 @@ void transform::TransformDialect::reportDuplicateOpRegistration(
llvm::raw_string_ostream msg(buffer);
msg << "extensible dialect operation '" << opName
<< "' is already registered with a mismatching TypeID";
msg.flush();
llvm::report_fatal_error(StringRef(buffer));
}

View File

@ -37,7 +37,6 @@ static std::string makeString(T array, bool breakline = false) {
os << "\n\t\t";
}
os << array.back() << "]";
os.flush();
return buf;
}

View File

@ -195,7 +195,6 @@ translateDataLayout(DataLayoutSpecInterface attribute,
bool isLittleEndian =
value.getValue() == DLTIDialect::kDataLayoutEndiannessLittle;
layoutStream << "-" << (isLittleEndian ? "e" : "E");
layoutStream.flush();
continue;
}
if (key.getValue() == DLTIDialect::kDataLayoutProgramMemorySpaceKey) {
@ -205,7 +204,6 @@ translateDataLayout(DataLayoutSpecInterface attribute,
if (space == 0)
continue;
layoutStream << "-P" << space;
layoutStream.flush();
continue;
}
if (key.getValue() == DLTIDialect::kDataLayoutGlobalMemorySpaceKey) {
@ -215,7 +213,6 @@ translateDataLayout(DataLayoutSpecInterface attribute,
if (space == 0)
continue;
layoutStream << "-G" << space;
layoutStream.flush();
continue;
}
if (key.getValue() == DLTIDialect::kDataLayoutAllocaMemorySpaceKey) {
@ -225,7 +222,6 @@ translateDataLayout(DataLayoutSpecInterface attribute,
if (space == 0)
continue;
layoutStream << "-A" << space;
layoutStream.flush();
continue;
}
if (key.getValue() == DLTIDialect::kDataLayoutStackAlignmentKey) {
@ -235,7 +231,6 @@ translateDataLayout(DataLayoutSpecInterface attribute,
if (alignment == 0)
continue;
layoutStream << "-S" << alignment;
layoutStream.flush();
continue;
}
emitError(*loc) << "unsupported data layout key " << key;
@ -293,7 +288,6 @@ translateDataLayout(DataLayoutSpecInterface attribute,
if (failed(result))
return failure();
}
layoutStream.flush();
StringRef layoutSpec(llvmDataLayout);
if (layoutSpec.starts_with("-"))
layoutSpec = layoutSpec.drop_front();

View File

@ -1411,7 +1411,6 @@ void OpEmitter::genPropertiesSupport() {
// Backward compat for now, TODO: Remove at some point.
os << " if (!attr) attr = dict.get(\"result_segment_sizes\");";
}
os.flush();
setPropMethod << "{\n"
<< formatv(propFromAttrFmt,
@ -1445,7 +1444,6 @@ void OpEmitter::genPropertiesSupport() {
// Backward compat for now
os << " if (!attr) attr = dict.get(\"result_segment_sizes\");";
}
os.flush();
setPropMethod << formatv(R"decl(
{{
@ -4188,10 +4186,8 @@ OpOperandAdaptorEmitter::OpOperandAdaptorEmitter(
" bool operator!=(const Properties &rhs) const {\n"
" return !(*this == rhs);\n"
" }\n";
comparatorOs.flush();
os << comparator;
os << " };\n";
os.flush();
genericAdaptorBase.declare<ExtraClassDeclaration>(std::move(declarations));
}

View File

@ -17,7 +17,6 @@ TEST(FormatTest, SingleLine) {
llvm::raw_string_ostream os(str);
raw_indented_ostream ros(os);
ros << 10;
ros.flush();
EXPECT_THAT(str, StrEq("10"));
}
@ -30,7 +29,6 @@ TEST(FormatTest, SimpleMultiLine) {
ros << "\n";
ros << "c";
ros << "\n";
ros.flush();
EXPECT_THAT(str, StrEq("ab\nc\n"));
}
@ -43,7 +41,6 @@ TEST(FormatTest, SimpleMultiLineIndent) {
ros << "\n";
ros << "c";
ros << "\n";
ros.flush();
EXPECT_THAT(str, StrEq(" a b\n c\n"));
}
@ -62,7 +59,6 @@ TEST(FormatTest, SingleRegion) {
}
}
ros << "after";
ros.flush();
const auto *expected =
R"(before
inside 10
@ -79,7 +75,6 @@ after)";
ros.scope().os << "inside " << 10 << "\n two\n";
ros.scope().os.scope("{\n", "\n}\n").os << "inner inner";
ros << "after";
ros.flush();
EXPECT_THAT(os.str(), StrEq(expected));
}
@ -99,7 +94,6 @@ TEST(FormatTest, Reindent) {
)";
ros.printReindented(desc);
ros.flush();
const auto *expected =
R"(First line
second line
@ -120,7 +114,6 @@ TEST(FormatTest, ReindentLineEndings) {
const auto *desc =
"\r\n\r\n\r\n First line\r\n second line";
ros.printReindented(desc);
ros.flush();
const auto *expected = "First line\r\n second line";
EXPECT_THAT(str, StrEq(expected));
}