[llvm] r228131 - [x86] Teach the test update script to strip trailing whitespace.

Chandler Carruth chandlerc at gmail.com
Wed Feb 4 02:46:48 PST 2015


Author: chandlerc
Date: Wed Feb  4 04:46:48 2015
New Revision: 228131

URL: http://llvm.org/viewvc/llvm-project?rev=228131&view=rev
Log:
[x86] Teach the test update script to strip trailing whitespace.

This is done in a bit of a strange way to use a multiline RE instead of
looping over the lines. Suggestions welcome here for a more pythonic way
of doing this as long as its reasonably fast.

Modified:
    llvm/trunk/utils/update_llc_test_checks.py

Modified: llvm/trunk/utils/update_llc_test_checks.py
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/update_llc_test_checks.py?rev=228131&r1=228130&r2=228131&view=diff
==============================================================================
--- llvm/trunk/utils/update_llc_test_checks.py (original)
+++ llvm/trunk/utils/update_llc_test_checks.py Wed Feb  4 04:46:48 2015
@@ -24,6 +24,7 @@ def llc(args, cmd_args, ir):
 
 
 ASM_SCRUB_WHITESPACE_RE = re.compile(r'(?!^(|  \w))[ \t]+', flags=re.M)
+ASM_SCRUB_TRAILING_WHITESPACE_RE = re.compile(r'[ \t]+$', flags=re.M)
 ASM_SCRUB_SHUFFLES_RE = (
     re.compile(
         r'^(\s*\w+) [^#\n]+#+ ((?:[xyz]mm\d+|mem) = .*)$',
@@ -47,6 +48,8 @@ def scrub_asm(asm):
   asm = ASM_SCRUB_RIP_RE.sub(r'{{.*}}(%rip)', asm)
   # Strip kill operands inserted into the asm.
   asm = ASM_SCRUB_KILL_COMMENT_RE.sub('', asm)
+  # Strip trailing whitespace.
+  asm = ASM_SCRUB_TRAILING_WHITESPACE_RE.sub(r'', asm)
   return asm
 
 





More information about the llvm-commits mailing list