[llvm-branch-commits] [llvm] 7181df1 - [update_llc_test_checks] Support Windows .seh_proc for x86

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


Author: Fangrui Song
Date: 2020-12-30T12:32:47-08:00
New Revision: 7181df1e4990bdeb55ebe38a0238db1e8c2f2001

URL: https://github.com/llvm/llvm-project/commit/7181df1e4990bdeb55ebe38a0238db1e8c2f2001
DIFF: https://github.com/llvm/llvm-project/commit/7181df1e4990bdeb55ebe38a0238db1e8c2f2001.diff

LOG: [update_llc_test_checks] Support Windows .seh_proc for x86

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 046de36137b0..1488c9f5b229 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
@@ -4,6 +4,9 @@
 ;; Check that we accept .Ldsolocal$local: below the function label.
 ; RUN: llc -mtriple=x86_64 -relocation-model=pic < %s | FileCheck %s --check-prefix=PIC
 
+;; Check that we accept .seh_proc below the function label.
+; RUN: llc -mtriple=x86_64-windows -relocation-model=pic < %s | FileCheck %s --check-prefix=WIN
+
 define hidden i32 @"_Z54bar$ompvariant$bar"() {
 entry:
   ret i32 2
@@ -11,5 +14,8 @@ entry:
 
 define dso_local i32 @dsolocal() {
 entry:
+  call void @ext()
   ret i32 2
 }
+
+declare void @ext()

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 64eaf90ed33b..000e780cb59c 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
@@ -5,6 +5,9 @@
 ;; Check that we accept .Ldsolocal$local: below the function label.
 ; RUN: llc -mtriple=x86_64 -relocation-model=pic < %s | FileCheck %s --check-prefix=PIC
 
+;; Check that we accept .seh_proc below the function label.
+; RUN: llc -mtriple=x86_64-windows -relocation-model=pic < %s | FileCheck %s --check-prefix=WIN
+
 define hidden i32 @"_Z54bar$ompvariant$bar"() {
 ; CHECK-LABEL: _Z54bar$ompvariant$bar:
 ; CHECK:       # %bb.0: # %entry
@@ -15,6 +18,11 @@ define hidden i32 @"_Z54bar$ompvariant$bar"() {
 ; PIC:       # %bb.0: # %entry
 ; PIC-NEXT:    movl $2, %eax
 ; PIC-NEXT:    retq
+;
+; WIN-LABEL: _Z54bar$ompvariant$bar:
+; WIN:       # %bb.0: # %entry
+; WIN-NEXT:    movl $2, %eax
+; WIN-NEXT:    retq
 entry:
   ret i32 2
 }
@@ -22,13 +30,37 @@ entry:
 define dso_local i32 @dsolocal() {
 ; CHECK-LABEL: dsolocal:
 ; CHECK:       # %bb.0: # %entry
+; CHECK-NEXT:    pushq %rax
+; CHECK-NEXT:    .cfi_def_cfa_offset 16
+; CHECK-NEXT:    callq ext at PLT
 ; CHECK-NEXT:    movl $2, %eax
+; CHECK-NEXT:    popq %rcx
+; CHECK-NEXT:    .cfi_def_cfa_offset 8
 ; CHECK-NEXT:    retq
 ;
 ; PIC-LABEL: dsolocal:
 ; PIC:       # %bb.0: # %entry
+; PIC-NEXT:    pushq %rax
+; PIC-NEXT:    .cfi_def_cfa_offset 16
+; PIC-NEXT:    callq ext at PLT
 ; PIC-NEXT:    movl $2, %eax
+; PIC-NEXT:    popq %rcx
+; PIC-NEXT:    .cfi_def_cfa_offset 8
 ; PIC-NEXT:    retq
+;
+; WIN-LABEL: dsolocal:
+; WIN:       # %bb.0: # %entry
+; WIN-NEXT:    subq $40, %rsp
+; WIN-NEXT:    .seh_stackalloc 40
+; WIN-NEXT:    .seh_endprologue
+; WIN-NEXT:    callq ext
+; WIN-NEXT:    movl $2, %eax
+; WIN-NEXT:    addq $40, %rsp
+; WIN-NEXT:    retq
+; WIN-NEXT:    .seh_endproc
 entry:
+  call void @ext()
   ret i32 2
 }
+
+declare void @ext()

diff  --git a/llvm/utils/UpdateTestChecks/asm.py b/llvm/utils/UpdateTestChecks/asm.py
index 7cfd31865a34..a42a75ed26bf 100644
--- a/llvm/utils/UpdateTestChecks/asm.py
+++ b/llvm/utils/UpdateTestChecks/asm.py
@@ -17,7 +17,7 @@ class string:
 ASM_FUNCTION_X86_RE = re.compile(
     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'(?:[ \t]+.cfi_startproc\n|.seh_proc[^\n]+\n)?'  # drop optional cfi
     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