[update_llc_test_checks] Support .Lfunc$local for x86 -relocation-model=pic dsolocal...
authorFangrui Song <i@maskray.me>
Wed, 30 Dec 2020 19:59:36 +0000 (11:59 -0800)
committerFangrui Song <i@maskray.me>
Wed, 30 Dec 2020 19:59:36 +0000 (11:59 -0800)
llvm/test/tools/UpdateTestChecks/update_llc_test_checks/Inputs/x86_function_name.ll
llvm/test/tools/UpdateTestChecks/update_llc_test_checks/Inputs/x86_function_name.ll.expected
llvm/utils/UpdateTestChecks/asm.py

index 231aa54..046de36 100644 (file)
@@ -1,8 +1,15 @@
-; Check that we accept functions with '$' in the name.
-;
-; RUN: llc -mtriple=x86_64-unknown-unknown < %s | FileCheck %s
-;
+;; Check that we accept functions with '$' in the name.
+; RUN: llc -mtriple=x86_64 < %s | FileCheck %s
+
+;; Check that we accept .Ldsolocal$local: below the function label.
+; RUN: llc -mtriple=x86_64 -relocation-model=pic < %s | FileCheck %s --check-prefix=PIC
+
 define hidden i32 @"_Z54bar$ompvariant$bar"() {
 entry:
   ret i32 2
 }
+
+define dso_local i32 @dsolocal() {
+entry:
+  ret i32 2
+}
index 32b05fc..64eaf90 100644 (file)
@@ -1,13 +1,34 @@
 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
-; Check that we accept functions with '$' in the name.
-;
-; RUN: llc -mtriple=x86_64-unknown-unknown < %s | FileCheck %s
-;
+;; Check that we accept functions with '$' in the name.
+; RUN: llc -mtriple=x86_64 < %s | FileCheck %s
+
+;; Check that we accept .Ldsolocal$local: below the function label.
+; RUN: llc -mtriple=x86_64 -relocation-model=pic < %s | FileCheck %s --check-prefix=PIC
+
 define hidden i32 @"_Z54bar$ompvariant$bar"() {
 ; CHECK-LABEL: _Z54bar$ompvariant$bar:
 ; CHECK:       # %bb.0: # %entry
 ; CHECK-NEXT:    movl $2, %eax
 ; CHECK-NEXT:    retq
+;
+; PIC-LABEL: _Z54bar$ompvariant$bar:
+; PIC:       # %bb.0: # %entry
+; PIC-NEXT:    movl $2, %eax
+; PIC-NEXT:    retq
+entry:
+  ret i32 2
+}
+
+define dso_local i32 @dsolocal() {
+; CHECK-LABEL: dsolocal:
+; CHECK:       # %bb.0: # %entry
+; CHECK-NEXT:    movl $2, %eax
+; CHECK-NEXT:    retq
+;
+; PIC-LABEL: dsolocal:
+; PIC:       # %bb.0: # %entry
+; PIC-NEXT:    movl $2, %eax
+; PIC-NEXT:    retq
 entry:
   ret i32 2
 }
index 839b727..7cfd318 100644 (file)
@@ -15,7 +15,9 @@ else:
 ##### Assembly parser
 
 ASM_FUNCTION_X86_RE = re.compile(
-    r'^_?(?P<func>[^:]+):[ \t]*#+[ \t]*(@"?(?P=func)"?| -- Begin function (?P=func))\n(?:\s*\.?Lfunc_begin[^:\n]*:\n)?[^:]*?'
+    r'^_?(?P<func>[^:]+):[ \t]*#+[ \t]*(@"?(?P=func)"?| -- Begin function (?P=func))\n(?:\s*\.?Lfunc_begin[^:\n]*:\n)?'
+    r'(?:\.L[^$]+\$local:\n)?'      # drop .L<func>$local:
+    r'(?:[ \t]+.cfi_startproc\n)?'  # drop optional cfi noise
     r'(?P<body>^##?[ \t]+[^:]+:.*?)\s*'
     r'^\s*(?:[^:\n]+?:\s*\n\s*\.size|\.cfi_endproc|\.globl|\.comm|\.(?:sub)?section|#+ -- End function)',
     flags=(re.M | re.S))