aboutsummaryrefslogtreecommitdiff
path: root/llvm/utils/UpdateTestChecks/asm.py
diff options
context:
space:
mode:
authorNicolai Hähnle <nicolai.haehnle@amd.com>2022-07-19 09:43:58 +0200
committerNicolai Hähnle <nicolai.haehnle@amd.com>2022-07-20 11:23:49 +0200
commit5a4033c36716de0cee75eb28b95cce44ae239cd9 (patch)
tree440f656bcde89deb5a46b05c886a0967994c7e08 /llvm/utils/UpdateTestChecks/asm.py
parent8ba794be31a314dccba8b4be309b463fdfc5cec5 (diff)
downloadllvm-5a4033c36716de0cee75eb28b95cce44ae239cd9.zip
llvm-5a4033c36716de0cee75eb28b95cce44ae239cd9.tar.gz
llvm-5a4033c36716de0cee75eb28b95cce44ae239cd9.tar.bz2
update-test-checks: safely handle tests with #if's
There is at least one Clang test (clang/test/CodeGen/arm_acle.c) which has functions guarded by #if's that cause those functions to be compiled only for a subset of RUN lines. This results in a case where one RUN line has a body for the function and another doesn't. Treat this case as a conflict for any prefixes that the two RUN lines have in common. This change exposed a bug where functions with '$' in the name weren't properly recognized in ARM assembly (despite there being a test case that was supposed to catch the problem!). This bug is fixed as well. Differential Revision: https://reviews.llvm.org/D130089
Diffstat (limited to 'llvm/utils/UpdateTestChecks/asm.py')
-rw-r--r--llvm/utils/UpdateTestChecks/asm.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/llvm/utils/UpdateTestChecks/asm.py b/llvm/utils/UpdateTestChecks/asm.py
index 953db74..821b2d0 100644
--- a/llvm/utils/UpdateTestChecks/asm.py
+++ b/llvm/utils/UpdateTestChecks/asm.py
@@ -23,10 +23,10 @@ ASM_FUNCTION_X86_RE = re.compile(
flags=(re.M | re.S))
ASM_FUNCTION_ARM_RE = re.compile(
- r'^(?P<func>[0-9a-zA-Z_]+):\n' # f: (name of function)
+ r'^(?P<func>[0-9a-zA-Z_$]+):\n' # f: (name of function)
r'\s+\.fnstart\n' # .fnstart
- r'(?P<body>.*?)\n' # (body of the function)
- r'.Lfunc_end[0-9]+:', # .Lfunc_end0: or # -- End function
+ r'(?P<body>.*?)' # (body of the function)
+ r'^.Lfunc_end[0-9]+:', # .Lfunc_end0: or # -- End function
flags=(re.M | re.S))
ASM_FUNCTION_AARCH64_RE = re.compile(
@@ -128,7 +128,8 @@ ASM_FUNCTION_AARCH64_DARWIN_RE = re.compile(
flags=(re.M | re.S))
ASM_FUNCTION_ARM_DARWIN_RE = re.compile(
- r'^[ \t]*\.globl[ \t]*_(?P<func>[^ \t])[ \t]*@[ \t]--[ \t]Begin[ \t]function[ \t]"?(?P=func)"?'
+ r'@[ \t]--[ \t]Begin[ \t]function[ \t](?P<func>[^ \t]+?)\n'
+ r'^[ \t]*\.globl[ \t]*_(?P=func)[ \t]*'
r'(?P<directives>.*?)'
r'^_(?P=func):\n[ \t]*'
r'(?P<body>.*?)'