[llvm] f743975 - Support other llc-like tools in update_llc_test_checks.py

Daniel Sanders via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 10 17:30:31 PDT 2020


Author: Daniel Sanders
Date: 2020-06-10T17:30:07-07:00
New Revision: f743975e0ab6c62839682b0bf09ca0e03269ed51

URL: https://github.com/llvm/llvm-project/commit/f743975e0ab6c62839682b0bf09ca0e03269ed51
DIFF: https://github.com/llvm/llvm-project/commit/f743975e0ab6c62839682b0bf09ca0e03269ed51.diff

LOG: Support other llc-like tools in update_llc_test_checks.py

Summary:
If you have downstream tools that are llc-like (e.g, llc with different
defaults), it's convenient to still be able to use
`update_llc_test_checks` with them. Refactor slightly to allow such tools
to be supported by adding them to LLC_LIKE_TOOLS

Reviewers: bogner

Subscribers: llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D80960

Added: 
    

Modified: 
    llvm/utils/update_llc_test_checks.py

Removed: 
    


################################################################################
diff  --git a/llvm/utils/update_llc_test_checks.py b/llvm/utils/update_llc_test_checks.py
index 23df4e16c9e7..d873c60187b7 100755
--- a/llvm/utils/update_llc_test_checks.py
+++ b/llvm/utils/update_llc_test_checks.py
@@ -20,11 +20,13 @@
 from UpdateTestChecks import asm, common
 
 ADVERT = ' NOTE: Assertions have been autogenerated by '
-
+# llc is the only llc-like in the LLVM tree but downstream forks can add
+# additional ones here if they have them.
+LLC_LIKE_TOOLS = ('llc',) 
 
 def main():
   parser = argparse.ArgumentParser(description=__doc__)
-  parser.add_argument('--llc-binary', default='llc',
+  parser.add_argument('--llc-binary', default=None,
                       help='The "llc" binary to use to generate the test case')
   parser.add_argument(
       '--function', help='The function in the test file to update')
@@ -91,7 +93,7 @@ def main():
       if len(commands) > 1:
         filecheck_cmd = commands[1]
       common.verify_filecheck_prefixes(filecheck_cmd)
-      if llc_tool != 'llc':
+      if llc_tool not in LLC_LIKE_TOOLS:
         common.warn('Skipping non-llc RUN line: ' + l)
         continue
 
@@ -129,7 +131,8 @@ def main():
       common.debug('Extracted LLC cmd:', llc_tool, llc_args)
       common.debug('Extracted FileCheck prefixes:', str(prefixes))
 
-      raw_tool_output = common.invoke_tool(args.llc_binary, llc_args, test)
+      raw_tool_output = common.invoke_tool(args.llc_binary or llc_tool,
+                                           llc_args, test)
       triple = triple_in_cmd or triple_in_ir
       if not triple:
         triple = asm.get_triple_from_march(march_in_cmd)


        


More information about the llvm-commits mailing list