-
Notifications
You must be signed in to change notification settings - Fork 14.4k
[mlir] Remove extra whitespace during printout in prop-dict (#145695) #145908
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@llvm/pr-subscribers-mlir-core Author: Manas (weirdsmiley) ChangesUsing character representation and removal of extra whitespace keeps printout consistent across cases. Full diff: https://github.com/llvm/llvm-project/pull/145908.diff 1 Files Affected:
diff --git a/mlir/lib/IR/AsmPrinter.cpp b/mlir/lib/IR/AsmPrinter.cpp
index c7cc6a02ad208..d9bd6444dda79 100644
--- a/mlir/lib/IR/AsmPrinter.cpp
+++ b/mlir/lib/IR/AsmPrinter.cpp
@@ -2848,7 +2848,7 @@ void AsmPrinter::Impl::printOptionalAttrDict(ArrayRef<NamedAttribute> attrs,
os << " attributes";
// Otherwise, print them all out in braces.
- os << " {";
+ os << '{';
interleaveComma(filteredAttrs,
[&](NamedAttribute attr) { printNamedAttribute(attr); });
os << '}';
|
@llvm/pr-subscribers-mlir Author: Manas (weirdsmiley) ChangesUsing character representation and removal of extra whitespace keeps printout consistent across cases. Full diff: https://github.com/llvm/llvm-project/pull/145908.diff 1 Files Affected:
diff --git a/mlir/lib/IR/AsmPrinter.cpp b/mlir/lib/IR/AsmPrinter.cpp
index c7cc6a02ad208..d9bd6444dda79 100644
--- a/mlir/lib/IR/AsmPrinter.cpp
+++ b/mlir/lib/IR/AsmPrinter.cpp
@@ -2848,7 +2848,7 @@ void AsmPrinter::Impl::printOptionalAttrDict(ArrayRef<NamedAttribute> attrs,
os << " attributes";
// Otherwise, print them all out in braces.
- os << " {";
+ os << '{';
interleaveComma(filteredAttrs,
[&](NamedAttribute attr) { printNamedAttribute(attr); });
os << '}';
|
I notice this fails CI. It wouldn't be a correct fix, because it removes whitespace from all cases which isn't ideal. I will send a v2. |
@River707 a question about the formatting: the issue only talks about keeping things consistent. So do we want to remove the whitespace from single attribute case or put extra whitespace in all cases? Visually, that would be: we can either make prop-dict look like |
Why do we have this extra whitespace in the first place? |
@joker-eph yes there are cases like this, outside of expected: if whitespace removed: There are more test cases like this (and probably others, total failed cases are 367). I got this from failed test cases ( I think that adding a whitespace in all cases would be consistent and will have a straightforward fix. |
I don't see what is "consistent" about adding an extra whitespace actually: it does not follow any existing convention and seems totally out-of-place to me. |
This API has a |
|
It wouldn't because the flag wouldn't be false in this context. |
What is the codepath that gets us there? Maybe it is just a matter of calling the right API instead of this one. |
Here is a fix for this bug: #145962 |
Using character representation and removal of extra whitespace keeps printout consistent across cases.