[llvm] update_test_checks: recognize %if in RUN line (PR #108972)

Elvina Yakubova via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 17 05:42:42 PDT 2024


https://github.com/ElvinaYakubova created https://github.com/llvm/llvm-project/pull/108972

Recognize %if for target-specific cases in RUN line and keep only tool command with options

>From 60adcfd00c33daeb67d454f59ea9819205259bb4 Mon Sep 17 00:00:00 2001
From: Elvina Yakubova <eyakubova at nvidia.com>
Date: Tue, 17 Sep 2024 03:11:43 -0700
Subject: [PATCH] update_test_checks: recognize %if in RUN line

---
 llvm/utils/update_test_checks.py | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/llvm/utils/update_test_checks.py b/llvm/utils/update_test_checks.py
index 16f3e618770b20..4bcc501f4d04a3 100755
--- a/llvm/utils/update_test_checks.py
+++ b/llvm/utils/update_test_checks.py
@@ -123,7 +123,13 @@ def main():
                 common.warn("Skipping unparsable RUN line: " + l)
                 continue
 
-            commands = [cmd.strip() for cmd in l.split("|")]
+            cropped_content = l
+            if "%if" in l:
+                match = re.search(r'%{\s*(.*?)\s*%}', l)
+                if match:
+                    cropped_content = match.group(1)
+
+            commands = [cmd.strip() for cmd in cropped_content.split("|")]
             assert len(commands) >= 2
             preprocess_cmd = None
             if len(commands) > 2:



More information about the llvm-commits mailing list