[llvm] 547e5e4 - [update_llc_test_checks.py] Fix MIPS ASM regex for functions with EH
Alex Richardson via llvm-commits
llvm-commits at lists.llvm.org
Tue Sep 28 09:57:56 PDT 2021
Author: Alex Richardson
Date: 2021-09-28T17:57:36+01:00
New Revision: 547e5e4ae613cf5ae3727abef84d5ac0334d9987
URL: https://github.com/llvm/llvm-project/commit/547e5e4ae613cf5ae3727abef84d5ac0334d9987
DIFF: https://github.com/llvm/llvm-project/commit/547e5e4ae613cf5ae3727abef84d5ac0334d9987.diff
LOG: [update_llc_test_checks.py] Fix MIPS ASM regex for functions with EH
On MIPS, functions with exception handling code emits an additional
temporary label at the start of the function (due to UseAssignmentForEHBegin):
_Z8do_catchv: # @_Z8do_catchv
.Ltmp3:
.set .Lfunc_begin0, .Ltmp3
.cfi_startproc
.cfi_personality 128, DW.ref.__gxx_personality_v0
.cfi_lsda 0, .Lexception0
.frame $c11,48,$c17
.mask 0x00000000,0
.fmask 0x00000000,0
.set noreorder
.set nomacro
.set noat
# %bb.0: # %entry
The `[^:]*` regex was terminating the search after .Ltmp<N>: and therefore
not detecting functions with exception handling.
Reviewed By: atanasyan, MaskRay
Differential Revision: https://reviews.llvm.org/D100027
Added:
Modified:
llvm/test/tools/UpdateTestChecks/update_llc_test_checks/Inputs/mips64_eh.ll
llvm/test/tools/UpdateTestChecks/update_llc_test_checks/Inputs/mips64_eh.ll.expected
llvm/utils/UpdateTestChecks/asm.py
Removed:
################################################################################
diff --git a/llvm/test/tools/UpdateTestChecks/update_llc_test_checks/Inputs/mips64_eh.ll b/llvm/test/tools/UpdateTestChecks/update_llc_test_checks/Inputs/mips64_eh.ll
index f5bf99c81f177..14d9cdbab802c 100644
--- a/llvm/test/tools/UpdateTestChecks/update_llc_test_checks/Inputs/mips64_eh.ll
+++ b/llvm/test/tools/UpdateTestChecks/update_llc_test_checks/Inputs/mips64_eh.ll
@@ -1,5 +1,4 @@
; RUN: llc -mtriple=mips64-unknown-linux < %s | FileCheck %s
-; FIXME: doesn't generate any CHECK lines
define i32 @main() personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*){
%1 = invoke i32 @foo() to label %good unwind label %bad
diff --git a/llvm/test/tools/UpdateTestChecks/update_llc_test_checks/Inputs/mips64_eh.ll.expected b/llvm/test/tools/UpdateTestChecks/update_llc_test_checks/Inputs/mips64_eh.ll.expected
index 08535a99f4289..897209a566149 100644
--- a/llvm/test/tools/UpdateTestChecks/update_llc_test_checks/Inputs/mips64_eh.ll.expected
+++ b/llvm/test/tools/UpdateTestChecks/update_llc_test_checks/Inputs/mips64_eh.ll.expected
@@ -1,8 +1,26 @@
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
; RUN: llc -mtriple=mips64-unknown-linux < %s | FileCheck %s
-; FIXME: doesn't generate any CHECK lines
define i32 @main() personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*){
+; CHECK-LABEL: main:
+; CHECK: # %bb.0:
+; CHECK-NEXT: daddiu $sp, $sp, -16
+; CHECK-NEXT: .cfi_def_cfa_offset 16
+; CHECK-NEXT: sd $ra, 8($sp) # 8-byte Folded Spill
+; CHECK-NEXT: .cfi_offset 31, -8
+; CHECK-NEXT: .Ltmp0:
+; CHECK-NEXT: jal foo
+; CHECK-NEXT: nop
+; CHECK-NEXT: .Ltmp1:
+; CHECK-NEXT: # %bb.1: # %good
+; CHECK-NEXT: addiu $2, $zero, 5
+; CHECK-NEXT: ld $ra, 8($sp) # 8-byte Folded Reload
+; CHECK-NEXT: jr $ra
+; CHECK-NEXT: daddiu $sp, $sp, 16
+; CHECK-NEXT: .LBB0_2: # %bad
+; CHECK-NEXT: .Ltmp2:
+; CHECK-NEXT: jal _Unwind_Resume
+; CHECK-NEXT: nop
%1 = invoke i32 @foo() to label %good unwind label %bad
good:
ret i32 5
diff --git a/llvm/utils/UpdateTestChecks/asm.py b/llvm/utils/UpdateTestChecks/asm.py
index 2a18899d55f07..a877fea8223ee 100644
--- a/llvm/utils/UpdateTestChecks/asm.py
+++ b/llvm/utils/UpdateTestChecks/asm.py
@@ -59,6 +59,7 @@ class string:
ASM_FUNCTION_MIPS_RE = re.compile(
r'^_?(?P<func>[^:]+):[ \t]*#+[ \t]*@"?(?P=func)"?\n[^:]*?' # f: (name of func)
+ r'(?:\s*\.?Ltmp[^:\n]*:\n)?[^:]*?' # optional .Ltmp<N> for EH
r'(?:^[ \t]+\.(frame|f?mask|set).*?\n)+' # Mips+LLVM standard asm prologue
r'(?P<body>.*?)\n' # (body of the function)
# Mips+LLVM standard asm epilogue
More information about the llvm-commits
mailing list