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

Simon Dardis via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue May 22 03:11:58 PDT 2018


sdardis created this revision.
sdardis added reviewers: RKSimon, spatel, MaskRay.

Rather than special casing asm check generation to simply output the check
lines, reflow the logic so that the IR and ASM check line generation use the 
same mechanism for handling blank lines.

This change enables the update_llc_test_checks.py utility to correctly generate
CHECK lines for inline assembly, where the llc can insert blank lines before
and after an inline assembly string.


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
@@ -190,16 +190,10 @@
       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 is_asm == False:
+          # 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.147976.patch
Type: text/x-patch
Size: 1942 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180522/754652fd/attachment.bin>


More information about the llvm-commits mailing list