-
Notifications
You must be signed in to change notification settings - Fork 15.3k
[mlir] generate-test-checks.py does not remove blank lines #166443
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 Author: Michael Maitland (michaelmaitland) ChangesWhen we generate test checks into the original test file (inplace), it was incorrectly removing empty lines. I tested this by running Full diff: https://github.com/llvm/llvm-project/pull/166443.diff 1 Files Affected:
diff --git a/mlir/utils/generate-test-checks.py b/mlir/utils/generate-test-checks.py
index 3712a6b9c963d..aae0b14965cad 100755
--- a/mlir/utils/generate-test-checks.py
+++ b/mlir/utils/generate-test-checks.py
@@ -234,10 +234,17 @@ def process_source_lines(source_lines, note, args):
source_split_re = re.compile(args.source_delim_regex)
source_segments = [[]]
+ skip_next_empty_line = False
for line in source_lines:
# Remove previous note.
- if line in note:
+ if line and line in note:
+ skip_next_empty_line = True
continue
+ # Skip the first empty line after the note
+ if skip_next_empty_line and not line:
+ skip_next_empty_line = False
+ continue
+ skip_next_empty_line = False
# Remove previous CHECK lines.
if line.find(args.check_prefix) != -1:
continue
|
When we generate test checks into the original test file (inplace), it was incorrectly
f1fac1a to
f941771
Compare
|
I think you're trying to patch a logic that was implemented in the wrong place originally. I would instead suggest this patch: |
Im more than happy to take your approach. do you want to make a PR? |
|
Sure, here you go: #166493 |
When we generate test checks into the original test file (inplace), it was incorrectly removing empty lines.
I tested this by running