[PATCH] D28572: [utils] Improve extraction of check prefixes from RUN lines

Nikolai Bozhenov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 11 10:50:13 PST 2017


n.bozhenov created this revision.
n.bozhenov added reviewers: chandlerc, spatel.
n.bozhenov added a subscriber: llvm-commits.

Correct handling of the following FileCheck options is implemented in
update_llc_test_checks.py and update_test_checks.py scripts:

1. -check-prefix (with a single dash)
2. -check-prefixes (with multiple prefixes)


https://reviews.llvm.org/D28572

Files:
  utils/update_llc_test_checks.py
  utils/update_test_checks.py


Index: utils/update_test_checks.py
===================================================================
--- utils/update_test_checks.py
+++ utils/update_test_checks.py
@@ -66,7 +66,7 @@
     r'^\s*define\s+(?:internal\s+)?[^@]*@(?P<func>[\w-]+?)\s*\('
     r'(\s+)?[^{]*\{\n(?P<body>.*?)^\}$',
     flags=(re.M | re.S))
-CHECK_PREFIX_RE = re.compile('--check-prefix=(\S+)')
+CHECK_PREFIX_RE = re.compile('--?check-prefix(?:es)?=(\S+)')
 CHECK_RE = re.compile(r'^\s*;\s*([^:]+?)(?:-NEXT|-NOT|-DAG|-LABEL)?:')
 IR_VALUE_DEF_RE = re.compile(r'\s+%(.*) =')
 
@@ -321,8 +321,8 @@
       tool_cmd_args = tool_cmd[len(tool_basename):].strip()
       tool_cmd_args = tool_cmd_args.replace('< %s', '').replace('%s', '').strip()
 
-      check_prefixes = [m.group(1)
-                        for m in CHECK_PREFIX_RE.finditer(filecheck_cmd)]
+      check_prefixes = [item for m in CHECK_PREFIX_RE.finditer(filecheck_cmd)
+                               for item in m.group(1).split(',')]
       if not check_prefixes:
         check_prefixes = ['CHECK']
 
Index: utils/update_llc_test_checks.py
===================================================================
--- utils/update_llc_test_checks.py
+++ utils/update_llc_test_checks.py
@@ -54,7 +54,7 @@
 TRIPLE_ARG_RE = re.compile(r'-mtriple=([^ ]+)')
 TRIPLE_IR_RE = re.compile(r'^target\s+triple\s*=\s*"([^"]+)"$')
 IR_FUNCTION_RE = re.compile('^\s*define\s+(?:internal\s+)?[^@]*@(\w+)\s*\(')
-CHECK_PREFIX_RE = re.compile('--check-prefix=(\S+)')
+CHECK_PREFIX_RE = re.compile('--?check-prefix(?:es)?=(\S+)')
 CHECK_RE = re.compile(r'^\s*;\s*([^:]+?)(?:-NEXT|-NOT|-DAG|-LABEL)?:')
 
 ASM_FUNCTION_PPC_RE = re.compile(
@@ -260,8 +260,8 @@
       llc_cmd_args = llc_cmd[len('llc'):].strip()
       llc_cmd_args = llc_cmd_args.replace('< %s', '').replace('%s', '').strip()
 
-      check_prefixes = [m.group(1)
-                        for m in CHECK_PREFIX_RE.finditer(filecheck_cmd)]
+      check_prefixes = [item for m in CHECK_PREFIX_RE.finditer(filecheck_cmd)
+                               for item in m.group(1).split(',')]
       if not check_prefixes:
         check_prefixes = ['CHECK']
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D28572.84002.patch
Type: text/x-patch
Size: 2138 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170111/2731a259/attachment.bin>


More information about the llvm-commits mailing list