[llvm-branch-commits] [llvm] 67c97ed - [UpdateTestChecks] Add --(no-)x86_scrub_sp option.

Harald van Dijk via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Sat Dec 12 09:16:14 PST 2020


Author: Harald van Dijk
Date: 2020-12-12T17:11:13Z
New Revision: 67c97ed4a5a99315b305750a7fc0aaa6744e3d37

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

LOG: [UpdateTestChecks] Add --(no-)x86_scrub_sp option.

This makes it possible to use update_llc_test_checks to manage tests
that check for incorrect x86 stack offsets. It does not yet modify any
test to make use of this new option.

Added: 
    

Modified: 
    llvm/utils/UpdateTestChecks/asm.py
    llvm/utils/update_llc_test_checks.py

Removed: 
    


################################################################################
diff  --git a/llvm/utils/UpdateTestChecks/asm.py b/llvm/utils/UpdateTestChecks/asm.py
index 24090fc2ea7e..476e7f1c75c9 100644
--- a/llvm/utils/UpdateTestChecks/asm.py
+++ b/llvm/utils/UpdateTestChecks/asm.py
@@ -177,8 +177,9 @@ def scrub_asm_x86(asm, args):
   # Detect stack spills and reloads and hide their exact offset and whether
   # they used the stack pointer or frame pointer.
   asm = SCRUB_X86_SPILL_RELOAD_RE.sub(r'{{[-0-9]+}}(%\1{{[sb]}}p)\2', asm)
-  # Generically match the stack offset of a memory operand.
-  asm = SCRUB_X86_SP_RE.sub(r'{{[0-9]+}}(%\1)', asm)
+  if getattr(args, 'x86_scrub_sp', True):
+    # Generically match the stack offset of a memory operand.
+    asm = SCRUB_X86_SP_RE.sub(r'{{[0-9]+}}(%\1)', asm)
   if getattr(args, 'x86_scrub_rip', False):
     # Generically match a RIP-relative memory operand.
     asm = SCRUB_X86_RIP_RE.sub(r'{{.*}}(%rip)', asm)

diff  --git a/llvm/utils/update_llc_test_checks.py b/llvm/utils/update_llc_test_checks.py
index b5422bd18791..2826b16fea2c 100755
--- a/llvm/utils/update_llc_test_checks.py
+++ b/llvm/utils/update_llc_test_checks.py
@@ -27,9 +27,14 @@ def main():
   parser.add_argument(
       '--extra_scrub', action='store_true',
       help='Always use additional regex to further reduce 
diff s between various subtargets')
+  parser.add_argument(
+      '--x86_scrub_sp', action='store_true', default=True,
+      help='Use regex for x86 sp matching to reduce 
diff s between various subtargets')
+  parser.add_argument(
+      '--no_x86_scrub_sp', action='store_false', dest='x86_scrub_sp')
   parser.add_argument(
       '--x86_scrub_rip', action='store_true', default=True,
-      help='Use more regex for x86 matching to reduce 
diff s between various subtargets')
+      help='Use more regex for x86 rip matching to reduce 
diff s between various subtargets')
   parser.add_argument(
       '--no_x86_scrub_rip', action='store_false', dest='x86_scrub_rip')
   parser.add_argument(


        


More information about the llvm-branch-commits mailing list