Skip to content

Commit 67c97ed

Browse files
committed
[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.
1 parent f61e5ec commit 67c97ed

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

llvm/utils/UpdateTestChecks/asm.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -177,8 +177,9 @@ def scrub_asm_x86(asm, args):
177177
# Detect stack spills and reloads and hide their exact offset and whether
178178
# they used the stack pointer or frame pointer.
179179
asm = SCRUB_X86_SPILL_RELOAD_RE.sub(r'{{[-0-9]+}}(%\1{{[sb]}}p)\2', asm)
180-
# Generically match the stack offset of a memory operand.
181-
asm = SCRUB_X86_SP_RE.sub(r'{{[0-9]+}}(%\1)', asm)
180+
if getattr(args, 'x86_scrub_sp', True):
181+
# Generically match the stack offset of a memory operand.
182+
asm = SCRUB_X86_SP_RE.sub(r'{{[0-9]+}}(%\1)', asm)
182183
if getattr(args, 'x86_scrub_rip', False):
183184
# Generically match a RIP-relative memory operand.
184185
asm = SCRUB_X86_RIP_RE.sub(r'{{.*}}(%rip)', asm)

llvm/utils/update_llc_test_checks.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,14 @@ def main():
2727
parser.add_argument(
2828
'--extra_scrub', action='store_true',
2929
help='Always use additional regex to further reduce diffs between various subtargets')
30+
parser.add_argument(
31+
'--x86_scrub_sp', action='store_true', default=True,
32+
help='Use regex for x86 sp matching to reduce diffs between various subtargets')
33+
parser.add_argument(
34+
'--no_x86_scrub_sp', action='store_false', dest='x86_scrub_sp')
3035
parser.add_argument(
3136
'--x86_scrub_rip', action='store_true', default=True,
32-
help='Use more regex for x86 matching to reduce diffs between various subtargets')
37+
help='Use more regex for x86 rip matching to reduce diffs between various subtargets')
3338
parser.add_argument(
3439
'--no_x86_scrub_rip', action='store_false', dest='x86_scrub_rip')
3540
parser.add_argument(

0 commit comments

Comments
 (0)