[PATCH] D80960: Support other llc-like tools in update_llc_test_checks.py

Daniel Sanders via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 1 15:43:32 PDT 2020


dsanders created this revision.
dsanders added a reviewer: bogner.
Herald added a project: LLVM.
bogner accepted this revision.
bogner added a comment.
This revision is now accepted and ready to land.

Seems straightforward enough. A couple of minor nitpicks.



================
Comment at: llvm/utils/update_llc_test_checks.py:23
 ADVERT = ' NOTE: Assertions have been autogenerated by '
-
+LLC_LIKE_TOOLS = ('llc',) 
 
----------------
A comment explaining why this is a tuple of one (much like the commit message) would be helpful here.


================
Comment at: llvm/utils/update_llc_test_checks.py:132
 
-      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
----------------
Please stick to 80-col


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


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D80960

Files:
  llvm/utils/update_llc_test_checks.py


Index: llvm/utils/update_llc_test_checks.py
===================================================================
--- llvm/utils/update_llc_test_checks.py
+++ llvm/utils/update_llc_test_checks.py
@@ -20,11 +20,11 @@
 from UpdateTestChecks import asm, common
 
 ADVERT = ' NOTE: Assertions have been autogenerated by '
-
+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 +91,7 @@
       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 +129,7 @@
       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)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D80960.267748.patch
Type: text/x-patch
Size: 1429 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200601/a0db0f80/attachment.bin>


More information about the llvm-commits mailing list