[llvm] 0f2c071 - [UpdateTestChecks] Handle nounwind functions for s390x

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 12 06:15:33 PST 2023


Author: Nikita Popov
Date: 2023-01-12T15:14:54+01:00
New Revision: 0f2c071fad60d7606ee1a05c71ab5e0510d5becc

URL: https://github.com/llvm/llvm-project/commit/0f2c071fad60d7606ee1a05c71ab5e0510d5becc
DIFF: https://github.com/llvm/llvm-project/commit/0f2c071fad60d7606ee1a05c71ab5e0510d5becc.diff

LOG: [UpdateTestChecks] Handle nounwind functions for s390x

Unlike all the other architectures, s390x requires cfi_startproc
to be present, so update_llc_test_checks did no work with nounwind
functions.

Added: 
    llvm/test/tools/UpdateTestChecks/update_llc_test_checks/Inputs/systemz-nounwind.ll
    llvm/test/tools/UpdateTestChecks/update_llc_test_checks/Inputs/systemz-nounwind.ll.expected
    llvm/test/tools/UpdateTestChecks/update_llc_test_checks/systemz-nounwind.test

Modified: 
    llvm/utils/UpdateTestChecks/asm.py

Removed: 
    


################################################################################
diff  --git a/llvm/test/tools/UpdateTestChecks/update_llc_test_checks/Inputs/systemz-nounwind.ll b/llvm/test/tools/UpdateTestChecks/update_llc_test_checks/Inputs/systemz-nounwind.ll
new file mode 100644
index 0000000000000..2e1781b02db4b
--- /dev/null
+++ b/llvm/test/tools/UpdateTestChecks/update_llc_test_checks/Inputs/systemz-nounwind.ll
@@ -0,0 +1,11 @@
+; RUN: llc -mtriple=s390x-unknown-linux < %s | FileCheck %s
+
+define i32 @unwind(i32 %a, i32 %b) {
+  %add = add i32 %a, %b
+  ret i32 %add
+}
+
+define i32 @nounwind(i32 %a, i32 %b) nounwind {
+  %add = add i32 %a, %b
+  ret i32 %add
+}

diff  --git a/llvm/test/tools/UpdateTestChecks/update_llc_test_checks/Inputs/systemz-nounwind.ll.expected b/llvm/test/tools/UpdateTestChecks/update_llc_test_checks/Inputs/systemz-nounwind.ll.expected
new file mode 100644
index 0000000000000..cd47ae92660d1
--- /dev/null
+++ b/llvm/test/tools/UpdateTestChecks/update_llc_test_checks/Inputs/systemz-nounwind.ll.expected
@@ -0,0 +1,20 @@
+; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
+; RUN: llc -mtriple=s390x-unknown-linux < %s | FileCheck %s
+
+define i32 @unwind(i32 %a, i32 %b) {
+; CHECK-LABEL: unwind:
+; CHECK:       # %bb.0:
+; CHECK-NEXT:    ar %r2, %r3
+; CHECK-NEXT:    br %r14
+  %add = add i32 %a, %b
+  ret i32 %add
+}
+
+define i32 @nounwind(i32 %a, i32 %b) nounwind {
+; CHECK-LABEL: nounwind:
+; CHECK:       # %bb.0:
+; CHECK-NEXT:    ar %r2, %r3
+; CHECK-NEXT:    br %r14
+  %add = add i32 %a, %b
+  ret i32 %add
+}

diff  --git a/llvm/test/tools/UpdateTestChecks/update_llc_test_checks/systemz-nounwind.test b/llvm/test/tools/UpdateTestChecks/update_llc_test_checks/systemz-nounwind.test
new file mode 100644
index 0000000000000..96e006646430a
--- /dev/null
+++ b/llvm/test/tools/UpdateTestChecks/update_llc_test_checks/systemz-nounwind.test
@@ -0,0 +1,5 @@
+# REQUIRES: systemz-registered-target
+## Check that nounwind functions are handled.
+
+# RUN: cp -f %S/Inputs/systemz-nounwind.ll %t.ll && %update_llc_test_checks %t.ll
+# RUN: 
diff  -u %S/Inputs/systemz-nounwind.ll.expected %t.ll

diff  --git a/llvm/utils/UpdateTestChecks/asm.py b/llvm/utils/UpdateTestChecks/asm.py
index f32c6ec753f36..e24197f3b63bb 100644
--- a/llvm/utils/UpdateTestChecks/asm.py
+++ b/llvm/utils/UpdateTestChecks/asm.py
@@ -125,7 +125,7 @@ class string:
 
 ASM_FUNCTION_SYSTEMZ_RE = re.compile(
     r'^_?(?P<func>[^:]+):[ \t]*#+[ \t]*@"?(?P=func)"?\n'
-    r'[ \t]+.cfi_startproc\n'
+    r'(?:[ \t]+.cfi_startproc\n)?'
     r'(?P<body>.*?)\n'
     r'.Lfunc_end[0-9]+:\n',
     flags=(re.M | re.S))


        


More information about the llvm-commits mailing list