[llvm] 6d27fa7 - [NFC][UTC] Avoid copy-paste in `update_analyze_test_checks.py` (#178456)
via llvm-commits
llvm-commits at lists.llvm.org
Thu Jan 29 10:33:03 PST 2026
Author: Andrei Elovikov
Date: 2026-01-29T18:32:58Z
New Revision: 6d27fa75919e4236db66bb55a7e8bd91844543b8
URL: https://github.com/llvm/llvm-project/commit/6d27fa75919e4236db66bb55a7e8bd91844543b8
DIFF: https://github.com/llvm/llvm-project/commit/6d27fa75919e4236db66bb55a7e8bd91844543b8.diff
LOG: [NFC][UTC] Avoid copy-paste in `update_analyze_test_checks.py` (#178456)
I'm going to extend it to support VPlan dump tests soon and this cleanup
avoids future growth of the `if/elif/elif` chain.
Added:
Modified:
llvm/utils/update_analyze_test_checks.py
Removed:
################################################################################
diff --git a/llvm/utils/update_analyze_test_checks.py b/llvm/utils/update_analyze_test_checks.py
index 3f14452767f9e..fa287110053e2 100755
--- a/llvm/utils/update_analyze_test_checks.py
+++ b/llvm/utils/update_analyze_test_checks.py
@@ -99,30 +99,22 @@ def update_test(opt_basename: str, ti: common.TestInfo):
raw_tool_outputs = common.invoke_tool(ti.args.opt_binary, opt_args, ti.path)
- if re.search(r"Printing analysis ", raw_tool_outputs) is not None:
- # Split analysis outputs by "Printing analysis " declarations.
- for raw_tool_output in re.split(r"Printing analysis ", raw_tool_outputs):
- builder.process_run_line(
- common.ANALYZE_FUNCTION_RE,
- common.scrub_body,
- raw_tool_output,
- prefixes,
- )
- elif (
- re.search(
- r"(LV|LDist|HashRecognize): Checking a loop in ", raw_tool_outputs
- )
- is not None
- ):
- for raw_tool_output in re.split(
- r"(LV|LDist|HashRecognize): Checking a loop in ", raw_tool_outputs
- ):
+ regex_map = {
+ r"Printing analysis ": common.ANALYZE_FUNCTION_RE,
+ r"(LV|LDist|HashRecognize): Checking a loop in ": common.LOOP_PASS_DEBUG_RE,
+ }
+
+ for split_by, regex in regex_map.items():
+ if re.search(split_by, raw_tool_outputs) is None:
+ continue
+ for raw_tool_output in re.split(split_by, raw_tool_outputs):
builder.process_run_line(
- common.LOOP_PASS_DEBUG_RE,
+ regex,
common.scrub_body,
raw_tool_output,
prefixes,
)
+ break
else:
common.warn("Don't know how to deal with this output")
continue
More information about the llvm-commits
mailing list