From f941771c33c78a0e3346e3613e3130a4fe2e060f Mon Sep 17 00:00:00 2001 From: Michael Maitland Date: Tue, 4 Nov 2025 12:40:50 -0800 Subject: [PATCH] [mlir] generate-test-checks.py does not double insert note. When we generate test checks into the original test file (inplace), it was incorrectly --- mlir/utils/generate-test-checks.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/mlir/utils/generate-test-checks.py b/mlir/utils/generate-test-checks.py index 3712a6b9c963d..741f0354e2050 100755 --- a/mlir/utils/generate-test-checks.py +++ b/mlir/utils/generate-test-checks.py @@ -234,10 +234,18 @@ 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 + if line: + skip_next_empty_line = False # Remove previous CHECK lines. if line.find(args.check_prefix) != -1: continue