[llvm-branch-commits] [llvm] 294a196 - [update_llc_test_checks] Support .Lfunc$local for x86 -relocation-model=pic dsolocal tests

Fangrui Song via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Wed Dec 30 12:03:46 PST 2020


Author: Fangrui Song
Date: 2020-12-30T11:59:36-08:00
New Revision: 294a196b0488c737544411bf570f4aa2a23f727e

URL: https://github.com/llvm/llvm-project/commit/294a196b0488c737544411bf570f4aa2a23f727e
DIFF: https://github.com/llvm/llvm-project/commit/294a196b0488c737544411bf570f4aa2a23f727e.diff

LOG: [update_llc_test_checks] Support .Lfunc$local for x86 -relocation-model=pic dsolocal tests

Added: 
    

Modified: 
    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

Removed: 
    


################################################################################
diff  --git a/llvm/test/tools/UpdateTestChecks/update_llc_test_checks/Inputs/x86_function_name.ll b/llvm/test/tools/UpdateTestChecks/update_llc_test_checks/Inputs/x86_function_name.ll
index 231aa54d6978..046de36137b0 100644
--- a/llvm/test/tools/UpdateTestChecks/update_llc_test_checks/Inputs/x86_function_name.ll
+++ b/llvm/test/tools/UpdateTestChecks/update_llc_test_checks/Inputs/x86_function_name.ll
@@ -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
+}

diff  --git a/llvm/test/tools/UpdateTestChecks/update_llc_test_checks/Inputs/x86_function_name.ll.expected b/llvm/test/tools/UpdateTestChecks/update_llc_test_checks/Inputs/x86_function_name.ll.expected
index 32b05fccf62b..64eaf90ed33b 100644
--- a/llvm/test/tools/UpdateTestChecks/update_llc_test_checks/Inputs/x86_function_name.ll.expected
+++ b/llvm/test/tools/UpdateTestChecks/update_llc_test_checks/Inputs/x86_function_name.ll.expected
@@ -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
 }

diff  --git a/llvm/utils/UpdateTestChecks/asm.py b/llvm/utils/UpdateTestChecks/asm.py
index 839b72730459..7cfd31865a34 100644
--- a/llvm/utils/UpdateTestChecks/asm.py
+++ b/llvm/utils/UpdateTestChecks/asm.py
@@ -15,7 +15,9 @@ class string:
 ##### 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))


        


More information about the llvm-branch-commits mailing list