[PATCH] D47192: [utils] Reflow asm check generation to tolerate blank lines

Simon Dardis via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu May 31 05:35:57 PDT 2018


sdardis updated this revision to Diff 149268.
sdardis added a comment.

Address review comments.


Repository:
  rL LLVM

https://reviews.llvm.org/D47192

Files:
  utils/UpdateTestChecks/common.py


Index: utils/UpdateTestChecks/common.py
===================================================================
--- utils/UpdateTestChecks/common.py
+++ utils/UpdateTestChecks/common.py
@@ -182,24 +182,18 @@
 
       # Add some space between different check prefixes, but not after the last
       # check line (before the test code).
-      if is_asm == True:
+      if not is_asm:
         if len(printed_prefixes) != 0:
           output_lines.append(comment_marker)
 
       printed_prefixes.append(checkprefix)
       output_lines.append(check_label_format % (checkprefix, func_name))
       func_body = func_dict[checkprefix][func_name].splitlines()
 
-      # For ASM output, just emit the check lines.
-      if is_asm == True:
-        output_lines.append('%s %s:       %s' % (comment_marker, checkprefix, func_body[0]))
-        for func_line in func_body[1:]:
-          output_lines.append('%s %s-NEXT:  %s' % (comment_marker, checkprefix, func_line))
-        break
-
       # For IR output, change all defs to FileCheck variables, so we're immune
       # to variable naming fashions.
-      func_body = genericize_check_lines(func_body, is_analyze)
+      if is_asm == False:
+        func_body = genericize_check_lines(func_body, is_analyze)
 
       # This could be selectively enabled with an optional invocation argument.
       # Disabled for now: better to check everything. Be safe rather than sorry.
@@ -212,14 +206,18 @@
       #  output_lines.append('%s %s:       %s' % (comment_marker, checkprefix, func_body[0]))
       #  is_blank_line = False
 
-      is_blank_line = False
+      # In the case of assembly there may be scrubbed lines between the label
+      # of a function and the start of the lines we're checking.
+      is_blank_line = is_asm
 
       for func_line in func_body:
         if func_line.strip() == '':
           is_blank_line = True
           continue
-        # Do not waste time checking IR comments.
-        func_line = SCRUB_IR_COMMENT_RE.sub(r'', func_line)
+
+        if not is_asm:
+          # Do not waste time checking IR comments.
+          func_line = SCRUB_IR_COMMENT_RE.sub(r'', func_line)
 
         # Skip blank lines instead of checking them.
         if is_blank_line == True:


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D47192.149268.patch
Type: text/x-patch
Size: 2245 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180531/65d0e6e6/attachment.bin>


More information about the llvm-commits mailing list