[llvm] ce0eb81 - [UpdateTestChecks] Allow $ in function names

David Greene via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 16 12:36:22 PDT 2020


Author: David Greene
Date: 2020-09-16T14:34:18-05:00
New Revision: ce0eb81c72749d1e96cfc6fb68af3c24b63753cc

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

LOG: [UpdateTestChecks] Allow $ in function names

Some compilers generation functions with '$' in their names, so recognize those
functions.

This also requires recognizing function names inside quotes in some contexts in
order to escape certain characters.

Differential Revision: https://reviews.llvm.org/D82995

Added: 
    llvm/test/tools/UpdateTestChecks/update_llc_test_checks/Inputs/aarch64_function_name.ll
    llvm/test/tools/UpdateTestChecks/update_llc_test_checks/Inputs/aarch64_function_name.ll.expected
    llvm/test/tools/UpdateTestChecks/update_llc_test_checks/Inputs/amdgpu_function_name.ll
    llvm/test/tools/UpdateTestChecks/update_llc_test_checks/Inputs/amdgpu_function_name.ll.expected
    llvm/test/tools/UpdateTestChecks/update_llc_test_checks/Inputs/arm_function_name.ll
    llvm/test/tools/UpdateTestChecks/update_llc_test_checks/Inputs/arm_function_name.ll.expected
    llvm/test/tools/UpdateTestChecks/update_llc_test_checks/Inputs/hexagon_function_name.ll
    llvm/test/tools/UpdateTestChecks/update_llc_test_checks/Inputs/hexagon_function_name.ll.expected
    llvm/test/tools/UpdateTestChecks/update_llc_test_checks/Inputs/lanai_function_name.ll
    llvm/test/tools/UpdateTestChecks/update_llc_test_checks/Inputs/lanai_function_name.ll.expected
    llvm/test/tools/UpdateTestChecks/update_llc_test_checks/Inputs/mips_function_name.ll
    llvm/test/tools/UpdateTestChecks/update_llc_test_checks/Inputs/mips_function_name.ll.expected
    llvm/test/tools/UpdateTestChecks/update_llc_test_checks/Inputs/msp430_function_name.ll
    llvm/test/tools/UpdateTestChecks/update_llc_test_checks/Inputs/msp430_function_name.ll.expected
    llvm/test/tools/UpdateTestChecks/update_llc_test_checks/Inputs/ppc_function_name.ll
    llvm/test/tools/UpdateTestChecks/update_llc_test_checks/Inputs/ppc_function_name.ll.expected
    llvm/test/tools/UpdateTestChecks/update_llc_test_checks/Inputs/riscv_function_name.ll
    llvm/test/tools/UpdateTestChecks/update_llc_test_checks/Inputs/riscv_function_name.ll.expected
    llvm/test/tools/UpdateTestChecks/update_llc_test_checks/Inputs/sparc_function_name.ll
    llvm/test/tools/UpdateTestChecks/update_llc_test_checks/Inputs/sparc_function_name.ll.expected
    llvm/test/tools/UpdateTestChecks/update_llc_test_checks/Inputs/systemz_function_name.ll
    llvm/test/tools/UpdateTestChecks/update_llc_test_checks/Inputs/systemz_function_name.ll.expected
    llvm/test/tools/UpdateTestChecks/update_llc_test_checks/Inputs/wasm_function_name.ll
    llvm/test/tools/UpdateTestChecks/update_llc_test_checks/Inputs/wasm_function_name.ll.expected
    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/test/tools/UpdateTestChecks/update_llc_test_checks/aarch64-function-name.test
    llvm/test/tools/UpdateTestChecks/update_llc_test_checks/amdgpu-function-name.test
    llvm/test/tools/UpdateTestChecks/update_llc_test_checks/arm-function-name.test
    llvm/test/tools/UpdateTestChecks/update_llc_test_checks/hexagon-function-name.test
    llvm/test/tools/UpdateTestChecks/update_llc_test_checks/lanai-function-name.test
    llvm/test/tools/UpdateTestChecks/update_llc_test_checks/mips-function-name.test
    llvm/test/tools/UpdateTestChecks/update_llc_test_checks/msp430-function-name.test
    llvm/test/tools/UpdateTestChecks/update_llc_test_checks/ppc-function-name.test
    llvm/test/tools/UpdateTestChecks/update_llc_test_checks/riscv-function-name.test
    llvm/test/tools/UpdateTestChecks/update_llc_test_checks/sparc-function-name.test
    llvm/test/tools/UpdateTestChecks/update_llc_test_checks/systemz-function-name.test
    llvm/test/tools/UpdateTestChecks/update_llc_test_checks/wasm-function-name.test
    llvm/test/tools/UpdateTestChecks/update_llc_test_checks/x86-function-name.test
    llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/function_name.ll
    llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/function_name.ll.expected
    llvm/test/tools/UpdateTestChecks/update_test_checks/function-name.test

Modified: 
    llvm/utils/UpdateTestChecks/asm.py
    llvm/utils/UpdateTestChecks/common.py

Removed: 
    


################################################################################
diff  --git a/llvm/test/tools/UpdateTestChecks/update_llc_test_checks/Inputs/aarch64_function_name.ll b/llvm/test/tools/UpdateTestChecks/update_llc_test_checks/Inputs/aarch64_function_name.ll
new file mode 100644
index 000000000000..1ea9d20146f1
--- /dev/null
+++ b/llvm/test/tools/UpdateTestChecks/update_llc_test_checks/Inputs/aarch64_function_name.ll
@@ -0,0 +1,9 @@
+; Check that we accept functions with '$' in the name.
+;
+; RUN: llc -mtriple=aarch64-unknown-linux < %s | FileCheck --check-prefix=LINUX %s
+; RUN: llc -mtriple=aarch64-apple-darwin < %s | FileCheck --check-prefix=DARWIN %s
+;
+define hidden i32 @"_Z54bar$ompvariant$bar"() {
+entry:
+  ret i32 2
+}

diff  --git a/llvm/test/tools/UpdateTestChecks/update_llc_test_checks/Inputs/aarch64_function_name.ll.expected b/llvm/test/tools/UpdateTestChecks/update_llc_test_checks/Inputs/aarch64_function_name.ll.expected
new file mode 100644
index 000000000000..fbe1caeea72d
--- /dev/null
+++ b/llvm/test/tools/UpdateTestChecks/update_llc_test_checks/Inputs/aarch64_function_name.ll.expected
@@ -0,0 +1,19 @@
+; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
+; Check that we accept functions with '$' in the name.
+;
+; RUN: llc -mtriple=aarch64-unknown-linux < %s | FileCheck --check-prefix=LINUX %s
+; RUN: llc -mtriple=aarch64-apple-darwin < %s | FileCheck --check-prefix=DARWIN %s
+;
+define hidden i32 @"_Z54bar$ompvariant$bar"() {
+; LINUX-LABEL: _Z54bar$ompvariant$bar:
+; LINUX:       // %bb.0: // %entry
+; LINUX-NEXT:    mov w0, #2
+; LINUX-NEXT:    ret
+;
+; DARWIN-LABEL: _Z54bar$ompvariant$bar:
+; DARWIN:       ; %bb.0: ; %entry
+; DARWIN-NEXT:    mov w0, #2
+; DARWIN-NEXT:    ret
+entry:
+  ret i32 2
+}

diff  --git a/llvm/test/tools/UpdateTestChecks/update_llc_test_checks/Inputs/amdgpu_function_name.ll b/llvm/test/tools/UpdateTestChecks/update_llc_test_checks/Inputs/amdgpu_function_name.ll
new file mode 100644
index 000000000000..b48607d2955f
--- /dev/null
+++ b/llvm/test/tools/UpdateTestChecks/update_llc_test_checks/Inputs/amdgpu_function_name.ll
@@ -0,0 +1,8 @@
+; Check that we accept functions with '$' in the name.
+;
+; RUN: llc -mtriple=amdgcn-amd-amdhsa < %s | FileCheck %s
+;
+define hidden i32 @"_Z54bar$ompvariant$bar"() {
+entry:
+  ret i32 2
+}

diff  --git a/llvm/test/tools/UpdateTestChecks/update_llc_test_checks/Inputs/amdgpu_function_name.ll.expected b/llvm/test/tools/UpdateTestChecks/update_llc_test_checks/Inputs/amdgpu_function_name.ll.expected
new file mode 100644
index 000000000000..e13058f32450
--- /dev/null
+++ b/llvm/test/tools/UpdateTestChecks/update_llc_test_checks/Inputs/amdgpu_function_name.ll.expected
@@ -0,0 +1,14 @@
+; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
+; Check that we accept functions with '$' in the name.
+;
+; RUN: llc -mtriple=amdgcn-amd-amdhsa < %s | FileCheck %s
+;
+define hidden i32 @"_Z54bar$ompvariant$bar"() {
+; CHECK-LABEL: _Z54bar$ompvariant$bar:
+; CHECK:       ; %bb.0: ; %entry
+; CHECK-NEXT:    s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
+; CHECK-NEXT:    v_mov_b32_e32 v0, 2
+; CHECK-NEXT:    s_setpc_b64 s[30:31]
+entry:
+  ret i32 2
+}

diff  --git a/llvm/test/tools/UpdateTestChecks/update_llc_test_checks/Inputs/arm_function_name.ll b/llvm/test/tools/UpdateTestChecks/update_llc_test_checks/Inputs/arm_function_name.ll
new file mode 100644
index 000000000000..6c0f9e971035
--- /dev/null
+++ b/llvm/test/tools/UpdateTestChecks/update_llc_test_checks/Inputs/arm_function_name.ll
@@ -0,0 +1,10 @@
+; Check that we accept functions with '$' in the name.
+;
+; RUN: llc -mtriple=arm64-unknown-linux < %s | FileCheck --prefi=LINUX %s
+; RUN: llc -mtriple=armv7-apple-darwin < %s | FileCheck --prefix=DARWIN %s
+; RUN: llc -mtriple=armv7-apple-ios < %s | FileCheck --prefix=IOS %s
+;
+define hidden i32 @"_Z54bar$ompvariant$bar"() {
+entry:
+  ret i32 2
+}

diff  --git a/llvm/test/tools/UpdateTestChecks/update_llc_test_checks/Inputs/arm_function_name.ll.expected b/llvm/test/tools/UpdateTestChecks/update_llc_test_checks/Inputs/arm_function_name.ll.expected
new file mode 100644
index 000000000000..e191b0497f0a
--- /dev/null
+++ b/llvm/test/tools/UpdateTestChecks/update_llc_test_checks/Inputs/arm_function_name.ll.expected
@@ -0,0 +1,15 @@
+; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
+; Check that we accept functions with '$' in the name.
+;
+; RUN: llc -mtriple=arm64-unknown-linux < %s | FileCheck --prefi=LINUX %s
+; RUN: llc -mtriple=armv7-apple-darwin < %s | FileCheck --prefix=DARWIN %s
+; RUN: llc -mtriple=armv7-apple-ios < %s | FileCheck --prefix=IOS %s
+;
+define hidden i32 @"_Z54bar$ompvariant$bar"() {
+; CHECK-LABEL: _Z54bar$ompvariant$bar:
+; CHECK:       // %bb.0: // %entry
+; CHECK-NEXT:    mov w0, #2
+; CHECK-NEXT:    ret
+entry:
+  ret i32 2
+}

diff  --git a/llvm/test/tools/UpdateTestChecks/update_llc_test_checks/Inputs/hexagon_function_name.ll b/llvm/test/tools/UpdateTestChecks/update_llc_test_checks/Inputs/hexagon_function_name.ll
new file mode 100644
index 000000000000..526f6bd5d461
--- /dev/null
+++ b/llvm/test/tools/UpdateTestChecks/update_llc_test_checks/Inputs/hexagon_function_name.ll
@@ -0,0 +1,8 @@
+; Check that we accept functions with '$' in the name.
+;
+; RUN: llc -mtriple=hexagon-unknown-linux < %s | FileCheck %s
+;
+define hidden i32 @"_Z54bar$ompvariant$bar"() {
+entry:
+  ret i32 2
+}

diff  --git a/llvm/test/tools/UpdateTestChecks/update_llc_test_checks/Inputs/hexagon_function_name.ll.expected b/llvm/test/tools/UpdateTestChecks/update_llc_test_checks/Inputs/hexagon_function_name.ll.expected
new file mode 100644
index 000000000000..9033be4aefee
--- /dev/null
+++ b/llvm/test/tools/UpdateTestChecks/update_llc_test_checks/Inputs/hexagon_function_name.ll.expected
@@ -0,0 +1,16 @@
+; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
+; Check that we accept functions with '$' in the name.
+;
+; RUN: llc -mtriple=hexagon-unknown-linux < %s | FileCheck %s
+;
+define hidden i32 @"_Z54bar$ompvariant$bar"() {
+; CHECK-LABEL: _Z54bar$ompvariant$bar:
+; CHECK:         .cfi_startproc
+; CHECK-NEXT:  // %bb.0: // %entry
+; CHECK-NEXT:    {
+; CHECK-NEXT:     r0 = #2
+; CHECK-NEXT:     jumpr r31
+; CHECK-NEXT:    }
+entry:
+  ret i32 2
+}

diff  --git a/llvm/test/tools/UpdateTestChecks/update_llc_test_checks/Inputs/lanai_function_name.ll b/llvm/test/tools/UpdateTestChecks/update_llc_test_checks/Inputs/lanai_function_name.ll
new file mode 100644
index 000000000000..c1c7d4f612e3
--- /dev/null
+++ b/llvm/test/tools/UpdateTestChecks/update_llc_test_checks/Inputs/lanai_function_name.ll
@@ -0,0 +1,8 @@
+; Check that we accept functions with '$' in the name.
+;
+; RUN: llc -mtriple=lanai-unknown-linux < %s | FileCheck %s
+;
+define hidden i32 @"_Z54bar$ompvariant$bar"() {
+entry:
+  ret i32 2
+}

diff  --git a/llvm/test/tools/UpdateTestChecks/update_llc_test_checks/Inputs/lanai_function_name.ll.expected b/llvm/test/tools/UpdateTestChecks/update_llc_test_checks/Inputs/lanai_function_name.ll.expected
new file mode 100644
index 000000000000..4f30c2397665
--- /dev/null
+++ b/llvm/test/tools/UpdateTestChecks/update_llc_test_checks/Inputs/lanai_function_name.ll.expected
@@ -0,0 +1,18 @@
+; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
+; Check that we accept functions with '$' in the name.
+;
+; RUN: llc -mtriple=lanai-unknown-linux < %s | FileCheck %s
+;
+define hidden i32 @"_Z54bar$ompvariant$bar"() {
+; CHECK-LABEL: _Z54bar$ompvariant$bar:
+; CHECK:       ! %bb.0: ! %entry
+; CHECK-NEXT:    st %fp, [--%sp]
+; CHECK-NEXT:    add %sp, 0x8, %fp
+; CHECK-NEXT:    sub %sp, 0x8, %sp
+; CHECK-NEXT:    mov 0x2, %rv
+; CHECK-NEXT:    ld -4[%fp], %pc ! return
+; CHECK-NEXT:    add %fp, 0x0, %sp
+; CHECK-NEXT:    ld -8[%fp], %fp
+entry:
+  ret i32 2
+}

diff  --git a/llvm/test/tools/UpdateTestChecks/update_llc_test_checks/Inputs/mips_function_name.ll b/llvm/test/tools/UpdateTestChecks/update_llc_test_checks/Inputs/mips_function_name.ll
new file mode 100644
index 000000000000..1cf2e3cfcc0c
--- /dev/null
+++ b/llvm/test/tools/UpdateTestChecks/update_llc_test_checks/Inputs/mips_function_name.ll
@@ -0,0 +1,8 @@
+; Check that we accept functions with '$' in the name.
+;
+; RUN: llc -mtriple=mips-unknown-linux < %s | FileCheck %s
+;
+define hidden i32 @"_Z54bar$ompvariant$bar"() {
+entry:
+  ret i32 2
+}

diff  --git a/llvm/test/tools/UpdateTestChecks/update_llc_test_checks/Inputs/mips_function_name.ll.expected b/llvm/test/tools/UpdateTestChecks/update_llc_test_checks/Inputs/mips_function_name.ll.expected
new file mode 100644
index 000000000000..c1c4577542e8
--- /dev/null
+++ b/llvm/test/tools/UpdateTestChecks/update_llc_test_checks/Inputs/mips_function_name.ll.expected
@@ -0,0 +1,13 @@
+; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
+; Check that we accept functions with '$' in the name.
+;
+; RUN: llc -mtriple=mips-unknown-linux < %s | FileCheck %s
+;
+define hidden i32 @"_Z54bar$ompvariant$bar"() {
+; CHECK-LABEL: _Z54bar$ompvariant$bar:
+; CHECK:       # %bb.0: # %entry
+; CHECK-NEXT:    jr $ra
+; CHECK-NEXT:    addiu $2, $zero, 2
+entry:
+  ret i32 2
+}

diff  --git a/llvm/test/tools/UpdateTestChecks/update_llc_test_checks/Inputs/msp430_function_name.ll b/llvm/test/tools/UpdateTestChecks/update_llc_test_checks/Inputs/msp430_function_name.ll
new file mode 100644
index 000000000000..1bf6ea93fbd1
--- /dev/null
+++ b/llvm/test/tools/UpdateTestChecks/update_llc_test_checks/Inputs/msp430_function_name.ll
@@ -0,0 +1,8 @@
+; Check that we accept functions with '$' in the name.
+;
+; RUN: llc -mtriple=msp430-unknown-linux < %s | FileCheck %s
+;
+define hidden i32 @"_Z54bar$ompvariant$bar"() {
+entry:
+  ret i32 2
+}

diff  --git a/llvm/test/tools/UpdateTestChecks/update_llc_test_checks/Inputs/msp430_function_name.ll.expected b/llvm/test/tools/UpdateTestChecks/update_llc_test_checks/Inputs/msp430_function_name.ll.expected
new file mode 100644
index 000000000000..2cb55cde0b76
--- /dev/null
+++ b/llvm/test/tools/UpdateTestChecks/update_llc_test_checks/Inputs/msp430_function_name.ll.expected
@@ -0,0 +1,14 @@
+; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
+; Check that we accept functions with '$' in the name.
+;
+; RUN: llc -mtriple=msp430-unknown-linux < %s | FileCheck %s
+;
+define hidden i32 @"_Z54bar$ompvariant$bar"() {
+; CHECK-LABEL: _Z54bar$ompvariant$bar:
+; CHECK:       ; %bb.0: ; %entry
+; CHECK-NEXT:    mov #2, r12
+; CHECK-NEXT:    clr r13
+; CHECK-NEXT:    ret
+entry:
+  ret i32 2
+}

diff  --git a/llvm/test/tools/UpdateTestChecks/update_llc_test_checks/Inputs/ppc_function_name.ll b/llvm/test/tools/UpdateTestChecks/update_llc_test_checks/Inputs/ppc_function_name.ll
new file mode 100644
index 000000000000..d4d1c68fd0ac
--- /dev/null
+++ b/llvm/test/tools/UpdateTestChecks/update_llc_test_checks/Inputs/ppc_function_name.ll
@@ -0,0 +1,8 @@
+; Check that we accept functions with '$' in the name.
+;
+; RUN: llc -mtriple=ppc32-unknown-linux < %s | FileCheck %s
+;
+define hidden i32 @"_Z54bar$ompvariant$bar"() {
+entry:
+  ret i32 2
+}

diff  --git a/llvm/test/tools/UpdateTestChecks/update_llc_test_checks/Inputs/ppc_function_name.ll.expected b/llvm/test/tools/UpdateTestChecks/update_llc_test_checks/Inputs/ppc_function_name.ll.expected
new file mode 100644
index 000000000000..72edada3ff06
--- /dev/null
+++ b/llvm/test/tools/UpdateTestChecks/update_llc_test_checks/Inputs/ppc_function_name.ll.expected
@@ -0,0 +1,13 @@
+; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
+; Check that we accept functions with '$' in the name.
+;
+; RUN: llc -mtriple=ppc32-unknown-linux < %s | FileCheck %s
+;
+define hidden i32 @"_Z54bar$ompvariant$bar"() {
+; CHECK-LABEL: _Z54bar$ompvariant$bar:
+; CHECK:       # %bb.0: # %entry
+; CHECK-NEXT:    li 3, 2
+; CHECK-NEXT:    blr
+entry:
+  ret i32 2
+}

diff  --git a/llvm/test/tools/UpdateTestChecks/update_llc_test_checks/Inputs/riscv_function_name.ll b/llvm/test/tools/UpdateTestChecks/update_llc_test_checks/Inputs/riscv_function_name.ll
new file mode 100644
index 000000000000..db4a1988a9b6
--- /dev/null
+++ b/llvm/test/tools/UpdateTestChecks/update_llc_test_checks/Inputs/riscv_function_name.ll
@@ -0,0 +1,8 @@
+; Check that we accept functions with '$' in the name.
+;
+; RUN: llc -mtriple=riscv32-unknown-linux < %s | FileCheck %s
+;
+define hidden i32 @"_Z54bar$ompvariant$bar"() {
+entry:
+  ret i32 2
+}

diff  --git a/llvm/test/tools/UpdateTestChecks/update_llc_test_checks/Inputs/riscv_function_name.ll.expected b/llvm/test/tools/UpdateTestChecks/update_llc_test_checks/Inputs/riscv_function_name.ll.expected
new file mode 100644
index 000000000000..d2ec3e0f9fcc
--- /dev/null
+++ b/llvm/test/tools/UpdateTestChecks/update_llc_test_checks/Inputs/riscv_function_name.ll.expected
@@ -0,0 +1,13 @@
+; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
+; Check that we accept functions with '$' in the name.
+;
+; RUN: llc -mtriple=riscv32-unknown-linux < %s | FileCheck %s
+;
+define hidden i32 @"_Z54bar$ompvariant$bar"() {
+; CHECK-LABEL: _Z54bar$ompvariant$bar:
+; CHECK:       # %bb.0: # %entry
+; CHECK-NEXT:    addi a0, zero, 2
+; CHECK-NEXT:    ret
+entry:
+  ret i32 2
+}

diff  --git a/llvm/test/tools/UpdateTestChecks/update_llc_test_checks/Inputs/sparc_function_name.ll b/llvm/test/tools/UpdateTestChecks/update_llc_test_checks/Inputs/sparc_function_name.ll
new file mode 100644
index 000000000000..8b4ae66f764d
--- /dev/null
+++ b/llvm/test/tools/UpdateTestChecks/update_llc_test_checks/Inputs/sparc_function_name.ll
@@ -0,0 +1,8 @@
+; Check that we accept functions with '$' in the name.
+;
+; RUN: llc -mtriple=sparc-unknown-linux < %s | FileCheck %s
+;
+define hidden i32 @"_Z54bar$ompvariant$bar"() {
+entry:
+  ret i32 2
+}

diff  --git a/llvm/test/tools/UpdateTestChecks/update_llc_test_checks/Inputs/sparc_function_name.ll.expected b/llvm/test/tools/UpdateTestChecks/update_llc_test_checks/Inputs/sparc_function_name.ll.expected
new file mode 100644
index 000000000000..72307c73a429
--- /dev/null
+++ b/llvm/test/tools/UpdateTestChecks/update_llc_test_checks/Inputs/sparc_function_name.ll.expected
@@ -0,0 +1,14 @@
+; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
+; Check that we accept functions with '$' in the name.
+;
+; RUN: llc -mtriple=sparc-unknown-linux < %s | FileCheck %s
+;
+define hidden i32 @"_Z54bar$ompvariant$bar"() {
+; CHECK-LABEL: _Z54bar$ompvariant$bar:
+; CHECK:         .cfi_startproc
+; CHECK-NEXT:  ! %bb.0: ! %entry
+; CHECK-NEXT:    retl
+; CHECK-NEXT:    mov 2, %o0
+entry:
+  ret i32 2
+}

diff  --git a/llvm/test/tools/UpdateTestChecks/update_llc_test_checks/Inputs/systemz_function_name.ll b/llvm/test/tools/UpdateTestChecks/update_llc_test_checks/Inputs/systemz_function_name.ll
new file mode 100644
index 000000000000..101bec2f0456
--- /dev/null
+++ b/llvm/test/tools/UpdateTestChecks/update_llc_test_checks/Inputs/systemz_function_name.ll
@@ -0,0 +1,8 @@
+; Check that we accept functions with '$' in the name.
+;
+; RUN: llc -mtriple=s390x-unknown-linux < %s | FileCheck %s
+;
+define hidden i32 @"_Z54bar$ompvariant$bar"() {
+entry:
+  ret i32 2
+}

diff  --git a/llvm/test/tools/UpdateTestChecks/update_llc_test_checks/Inputs/systemz_function_name.ll.expected b/llvm/test/tools/UpdateTestChecks/update_llc_test_checks/Inputs/systemz_function_name.ll.expected
new file mode 100644
index 000000000000..c5dade171110
--- /dev/null
+++ b/llvm/test/tools/UpdateTestChecks/update_llc_test_checks/Inputs/systemz_function_name.ll.expected
@@ -0,0 +1,13 @@
+; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
+; Check that we accept functions with '$' in the name.
+;
+; RUN: llc -mtriple=s390x-unknown-linux < %s | FileCheck %s
+;
+define hidden i32 @"_Z54bar$ompvariant$bar"() {
+; CHECK-LABEL: _Z54bar$ompvariant$bar:
+; CHECK:       # %bb.0: # %entry
+; CHECK-NEXT:    lhi %r2, 2
+; CHECK-NEXT:    br %r14
+entry:
+  ret i32 2
+}

diff  --git a/llvm/test/tools/UpdateTestChecks/update_llc_test_checks/Inputs/wasm_function_name.ll b/llvm/test/tools/UpdateTestChecks/update_llc_test_checks/Inputs/wasm_function_name.ll
new file mode 100644
index 000000000000..a55cd8efd60b
--- /dev/null
+++ b/llvm/test/tools/UpdateTestChecks/update_llc_test_checks/Inputs/wasm_function_name.ll
@@ -0,0 +1,8 @@
+; Check that we accept functions with '$' in the name.
+;
+; RUN: llc -mtriple=wasm32-unknown-linux < %s | FileCheck %s
+;
+define hidden i32 @"_Z54bar$ompvariant$bar"() {
+entry:
+  ret i32 2
+}

diff  --git a/llvm/test/tools/UpdateTestChecks/update_llc_test_checks/Inputs/wasm_function_name.ll.expected b/llvm/test/tools/UpdateTestChecks/update_llc_test_checks/Inputs/wasm_function_name.ll.expected
new file mode 100644
index 000000000000..e5a10a3e07c6
--- /dev/null
+++ b/llvm/test/tools/UpdateTestChecks/update_llc_test_checks/Inputs/wasm_function_name.ll.expected
@@ -0,0 +1,14 @@
+; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
+; Check that we accept functions with '$' in the name.
+;
+; RUN: llc -mtriple=wasm32-unknown-linux < %s | FileCheck %s
+;
+define hidden i32 @"_Z54bar$ompvariant$bar"() {
+; CHECK-LABEL: _Z54bar$ompvariant$bar:
+; CHECK:         .functype _Z54bar$ompvariant$bar () -> (i32)
+; CHECK-NEXT:  # %bb.0: # %entry
+; CHECK-NEXT:    i32.const 2
+; CHECK-NEXT:    # fallthrough-return
+entry:
+  ret i32 2
+}

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
new file mode 100644
index 000000000000..231aa54d6978
--- /dev/null
+++ b/llvm/test/tools/UpdateTestChecks/update_llc_test_checks/Inputs/x86_function_name.ll
@@ -0,0 +1,8 @@
+; Check that we accept functions with '$' in the name.
+;
+; RUN: llc -mtriple=x86_64-unknown-unknown < %s | FileCheck %s
+;
+define hidden i32 @"_Z54bar$ompvariant$bar"() {
+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
new file mode 100644
index 000000000000..32b05fccf62b
--- /dev/null
+++ b/llvm/test/tools/UpdateTestChecks/update_llc_test_checks/Inputs/x86_function_name.ll.expected
@@ -0,0 +1,13 @@
+; 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
+;
+define hidden i32 @"_Z54bar$ompvariant$bar"() {
+; CHECK-LABEL: _Z54bar$ompvariant$bar:
+; CHECK:       # %bb.0: # %entry
+; CHECK-NEXT:    movl $2, %eax
+; CHECK-NEXT:    retq
+entry:
+  ret i32 2
+}

diff  --git a/llvm/test/tools/UpdateTestChecks/update_llc_test_checks/aarch64-function-name.test b/llvm/test/tools/UpdateTestChecks/update_llc_test_checks/aarch64-function-name.test
new file mode 100644
index 000000000000..36c96cc329fd
--- /dev/null
+++ b/llvm/test/tools/UpdateTestChecks/update_llc_test_checks/aarch64-function-name.test
@@ -0,0 +1,5 @@
+# REQUIRES: aarch64-registered-target
+## Check that functions names with '$' are processed correctly
+
+# RUN: cp -f %S/Inputs/aarch64_function_name.ll %t.ll && %update_llc_test_checks %t.ll
+# RUN: 
diff  -u %S/Inputs/aarch64_function_name.ll.expected %t.ll

diff  --git a/llvm/test/tools/UpdateTestChecks/update_llc_test_checks/amdgpu-function-name.test b/llvm/test/tools/UpdateTestChecks/update_llc_test_checks/amdgpu-function-name.test
new file mode 100644
index 000000000000..eb4092d5a460
--- /dev/null
+++ b/llvm/test/tools/UpdateTestChecks/update_llc_test_checks/amdgpu-function-name.test
@@ -0,0 +1,5 @@
+# REQUIRES: amdgpu-registered-target
+## Check that functions names with '$' are processed correctly
+
+# RUN: cp -f %S/Inputs/amdgpu_function_name.ll %t.ll && %update_llc_test_checks %t.ll
+# RUN: 
diff  -u %S/Inputs/amdgpu_function_name.ll.expected %t.ll

diff  --git a/llvm/test/tools/UpdateTestChecks/update_llc_test_checks/arm-function-name.test b/llvm/test/tools/UpdateTestChecks/update_llc_test_checks/arm-function-name.test
new file mode 100644
index 000000000000..07455cbf13c0
--- /dev/null
+++ b/llvm/test/tools/UpdateTestChecks/update_llc_test_checks/arm-function-name.test
@@ -0,0 +1,5 @@
+# REQUIRES: arm-registered-target
+## Check that functions names with '$' are processed correctly
+
+# RUN: cp -f %S/Inputs/arm_function_name.ll %t.ll && %update_llc_test_checks %t.ll
+# RUN: 
diff  -u %S/Inputs/arm_function_name.ll.expected %t.ll

diff  --git a/llvm/test/tools/UpdateTestChecks/update_llc_test_checks/hexagon-function-name.test b/llvm/test/tools/UpdateTestChecks/update_llc_test_checks/hexagon-function-name.test
new file mode 100644
index 000000000000..1e34074255fd
--- /dev/null
+++ b/llvm/test/tools/UpdateTestChecks/update_llc_test_checks/hexagon-function-name.test
@@ -0,0 +1,5 @@
+# REQUIRES: hexagon-registered-target
+## Check that functions names with '$' are processed correctly
+
+# RUN: cp -f %S/Inputs/hexagon_function_name.ll %t.ll && %update_llc_test_checks %t.ll
+# RUN: 
diff  -u %S/Inputs/hexagon_function_name.ll.expected %t.ll

diff  --git a/llvm/test/tools/UpdateTestChecks/update_llc_test_checks/lanai-function-name.test b/llvm/test/tools/UpdateTestChecks/update_llc_test_checks/lanai-function-name.test
new file mode 100644
index 000000000000..cb5aa4e45ffa
--- /dev/null
+++ b/llvm/test/tools/UpdateTestChecks/update_llc_test_checks/lanai-function-name.test
@@ -0,0 +1,5 @@
+# REQUIRES: lanai-registered-target
+## Check that functions names with '$' are processed correctly
+
+# RUN: cp -f %S/Inputs/lanai_function_name.ll %t.ll && %update_llc_test_checks %t.ll
+# RUN: 
diff  -u %S/Inputs/lanai_function_name.ll.expected %t.ll

diff  --git a/llvm/test/tools/UpdateTestChecks/update_llc_test_checks/mips-function-name.test b/llvm/test/tools/UpdateTestChecks/update_llc_test_checks/mips-function-name.test
new file mode 100644
index 000000000000..03f9149d5c02
--- /dev/null
+++ b/llvm/test/tools/UpdateTestChecks/update_llc_test_checks/mips-function-name.test
@@ -0,0 +1,5 @@
+# REQUIRES: mips-registered-target
+## Check that functions names with '$' are processed correctly
+
+# RUN: cp -f %S/Inputs/mips_function_name.ll %t.ll && %update_llc_test_checks %t.ll
+# RUN: 
diff  -u %S/Inputs/mips_function_name.ll.expected %t.ll

diff  --git a/llvm/test/tools/UpdateTestChecks/update_llc_test_checks/msp430-function-name.test b/llvm/test/tools/UpdateTestChecks/update_llc_test_checks/msp430-function-name.test
new file mode 100644
index 000000000000..8f676227aa32
--- /dev/null
+++ b/llvm/test/tools/UpdateTestChecks/update_llc_test_checks/msp430-function-name.test
@@ -0,0 +1,5 @@
+# REQUIRES: msp430-registered-target
+## Check that functions names with '$' are processed correctly
+
+# RUN: cp -f %S/Inputs/msp430_function_name.ll %t.ll && %update_llc_test_checks %t.ll
+# RUN: 
diff  -u %S/Inputs/msp430_function_name.ll.expected %t.ll

diff  --git a/llvm/test/tools/UpdateTestChecks/update_llc_test_checks/ppc-function-name.test b/llvm/test/tools/UpdateTestChecks/update_llc_test_checks/ppc-function-name.test
new file mode 100644
index 000000000000..824740cde6f5
--- /dev/null
+++ b/llvm/test/tools/UpdateTestChecks/update_llc_test_checks/ppc-function-name.test
@@ -0,0 +1,5 @@
+# REQUIRES: powerpc-registered-target
+## Check that functions names with '$' are processed correctly
+
+# RUN: cp -f %S/Inputs/ppc_function_name.ll %t.ll && %update_llc_test_checks %t.ll
+# RUN: 
diff  -u %S/Inputs/ppc_function_name.ll.expected %t.ll

diff  --git a/llvm/test/tools/UpdateTestChecks/update_llc_test_checks/riscv-function-name.test b/llvm/test/tools/UpdateTestChecks/update_llc_test_checks/riscv-function-name.test
new file mode 100644
index 000000000000..2e1e05d88f9a
--- /dev/null
+++ b/llvm/test/tools/UpdateTestChecks/update_llc_test_checks/riscv-function-name.test
@@ -0,0 +1,5 @@
+# REQUIRES: riscv-registered-target
+## Check that functions names with '$' are processed correctly
+
+# RUN: cp -f %S/Inputs/riscv_function_name.ll %t.ll && %update_llc_test_checks %t.ll
+# RUN: 
diff  -u %S/Inputs/riscv_function_name.ll.expected %t.ll

diff  --git a/llvm/test/tools/UpdateTestChecks/update_llc_test_checks/sparc-function-name.test b/llvm/test/tools/UpdateTestChecks/update_llc_test_checks/sparc-function-name.test
new file mode 100644
index 000000000000..a223ee211da3
--- /dev/null
+++ b/llvm/test/tools/UpdateTestChecks/update_llc_test_checks/sparc-function-name.test
@@ -0,0 +1,5 @@
+# REQUIRES: sparc-registered-target
+## Check that functions names with '$' are processed correctly
+
+# RUN: cp -f %S/Inputs/sparc_function_name.ll %t.ll && %update_llc_test_checks %t.ll
+# RUN: 
diff  -u %S/Inputs/sparc_function_name.ll.expected %t.ll

diff  --git a/llvm/test/tools/UpdateTestChecks/update_llc_test_checks/systemz-function-name.test b/llvm/test/tools/UpdateTestChecks/update_llc_test_checks/systemz-function-name.test
new file mode 100644
index 000000000000..e6c47252d454
--- /dev/null
+++ b/llvm/test/tools/UpdateTestChecks/update_llc_test_checks/systemz-function-name.test
@@ -0,0 +1,5 @@
+# REQUIRES: systemz-registered-target
+## Check that functions names with '$' are processed correctly
+
+# RUN: cp -f %S/Inputs/systemz_function_name.ll %t.ll && %update_llc_test_checks %t.ll
+# RUN: 
diff  -u %S/Inputs/systemz_function_name.ll.expected %t.ll

diff  --git a/llvm/test/tools/UpdateTestChecks/update_llc_test_checks/wasm-function-name.test b/llvm/test/tools/UpdateTestChecks/update_llc_test_checks/wasm-function-name.test
new file mode 100644
index 000000000000..fc45e28415dd
--- /dev/null
+++ b/llvm/test/tools/UpdateTestChecks/update_llc_test_checks/wasm-function-name.test
@@ -0,0 +1,5 @@
+# REQUIRES: webassembly-registered-target
+## Check that functions names with '$' are processed correctly
+
+# RUN: cp -f %S/Inputs/wasm_function_name.ll %t.ll && %update_llc_test_checks %t.ll
+# RUN: 
diff  -u %S/Inputs/wasm_function_name.ll.expected %t.ll

diff  --git a/llvm/test/tools/UpdateTestChecks/update_llc_test_checks/x86-function-name.test b/llvm/test/tools/UpdateTestChecks/update_llc_test_checks/x86-function-name.test
new file mode 100644
index 000000000000..d395afb13971
--- /dev/null
+++ b/llvm/test/tools/UpdateTestChecks/update_llc_test_checks/x86-function-name.test
@@ -0,0 +1,5 @@
+# REQUIRES: x86-registered-target
+## Check that functions names with '$' are processed correctly
+
+# RUN: cp -f %S/Inputs/x86_function_name.ll %t.ll && %update_llc_test_checks %t.ll
+# RUN: 
diff  -u %S/Inputs/x86_function_name.ll.expected %t.ll

diff  --git a/llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/function_name.ll b/llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/function_name.ll
new file mode 100644
index 000000000000..173e7219cb3f
--- /dev/null
+++ b/llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/function_name.ll
@@ -0,0 +1,8 @@
+; Check that we accept functions with '$' in the name.
+;
+; RUN: opt < %s -instsimplify -S | FileCheck %s
+;
+define hidden i32 @"_Z54bar$ompvariant$bar"() {
+entry:
+  ret i32 2
+}

diff  --git a/llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/function_name.ll.expected b/llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/function_name.ll.expected
new file mode 100644
index 000000000000..75e4235eb440
--- /dev/null
+++ b/llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/function_name.ll.expected
@@ -0,0 +1,9 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
+; Check that we accept functions with '$' in the name.
+;
+; RUN: opt < %s -instsimplify -S | FileCheck %s
+;
+define hidden i32 @"_Z54bar$ompvariant$bar"() {
+entry:
+  ret i32 2
+}

diff  --git a/llvm/test/tools/UpdateTestChecks/update_test_checks/function-name.test b/llvm/test/tools/UpdateTestChecks/update_test_checks/function-name.test
new file mode 100644
index 000000000000..3d1a158e00bc
--- /dev/null
+++ b/llvm/test/tools/UpdateTestChecks/update_test_checks/function-name.test
@@ -0,0 +1,7 @@
+# REQUIRES: x86-registered-target
+## Basic test checking that update_test_checks.py works correctly
+# RUN: cp -f %S/Inputs/function_name.ll %t.ll && %update_test_checks %t.ll
+# RUN: 
diff  -u %t.ll %S/Inputs/function_name.ll.expected
+## Check that running the script again does not change the result:
+# RUN: %update_test_checks %t.ll
+# RUN: 
diff  -u %t.ll %S/Inputs/function_name.ll.expected

diff  --git a/llvm/utils/UpdateTestChecks/asm.py b/llvm/utils/UpdateTestChecks/asm.py
index 588a2870b989..dc35859606e0 100644
--- a/llvm/utils/UpdateTestChecks/asm.py
+++ b/llvm/utils/UpdateTestChecks/asm.py
@@ -15,7 +15,7 @@ class string:
 ##### Assembly parser
 
 ASM_FUNCTION_X86_RE = re.compile(
-    r'^_?(?P<func>[^:]+):[ \t]*#+[ \t]*@(?P=func)\n(?:\s*\.?Lfunc_begin[^:\n]*:\n)?[^:]*?'
+    r'^_?(?P<func>[^:]+):[ \t]*#+[ \t]*@"?(?P=func)"?\n(?:\s*\.?Lfunc_begin[^:\n]*:\n)?[^:]*?'
     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))
@@ -28,7 +28,7 @@ class string:
         flags=(re.M | re.S))
 
 ASM_FUNCTION_AARCH64_RE = re.compile(
-     r'^_?(?P<func>[^:]+):[ \t]*\/\/[ \t]*@(?P=func)\n'
+     r'^_?(?P<func>[^:]+):[ \t]*\/\/[ \t]*@"?(?P=func)"?\n'
      r'(?:[ \t]+.cfi_startproc\n)?'  # drop optional cfi noise
      r'(?P<body>.*?)\n'
      # This list is incomplete
@@ -36,21 +36,21 @@ class string:
      flags=(re.M | re.S))
 
 ASM_FUNCTION_AMDGPU_RE = re.compile(
-    r'^_?(?P<func>[^:]+):[ \t]*;+[ \t]*@(?P=func)\n[^:]*?'
+    r'^_?(?P<func>[^:]+):[ \t]*;+[ \t]*@"?(?P=func)"?\n[^:]*?'
     r'(?P<body>.*?)\n' # (body of the function)
     # This list is incomplete
     r'^\s*(\.Lfunc_end[0-9]+:\n|\.section)',
     flags=(re.M | re.S))
 
 ASM_FUNCTION_HEXAGON_RE = re.compile(
-    r'^_?(?P<func>[^:]+):[ \t]*//[ \t]*@(?P=func)\n[^:]*?'
+    r'^_?(?P<func>[^:]+):[ \t]*//[ \t]*@"?(?P=func)"?\n[^:]*?'
     r'(?P<body>.*?)\n' # (body of the function)
     # This list is incomplete
     r'.Lfunc_end[0-9]+:\n',
     flags=(re.M | re.S))
 
 ASM_FUNCTION_MIPS_RE = re.compile(
-    r'^_?(?P<func>[^:]+):[ \t]*#+[ \t]*@(?P=func)\n[^:]*?' # f: (name of func)
+    r'^_?(?P<func>[^:]+):[ \t]*#+[ \t]*@"?(?P=func)"?\n[^:]*?' # f: (name of func)
     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
@@ -60,13 +60,13 @@ class string:
     flags=(re.M | re.S))
 
 ASM_FUNCTION_MSP430_RE = re.compile(
-    r'^_?(?P<func>[^:]+):[ \t]*;+[ \t]*@(?P=func)\n[^:]*?'
+    r'^_?(?P<func>[^:]+):[ \t]*;+[ \t]*@"?(?P=func)"?\n[^:]*?'
     r'(?P<body>.*?)\n'
     r'(\$|\.L)func_end[0-9]+:\n',             # $func_end0:
     flags=(re.M | re.S))
 
 ASM_FUNCTION_PPC_RE = re.compile(
-    r'^_?(?P<func>[^:]+):[ \t]*#+[ \t]*@(?P=func)\n'
+    r'^_?(?P<func>[^:]+):[ \t]*#+[ \t]*@"?(?P=func)"?\n'
     r'.*?'
     r'\.Lfunc_begin[0-9]+:\n'
     r'(?:[ \t]+.cfi_startproc\n)?'
@@ -78,7 +78,7 @@ class string:
     flags=(re.M | re.S))
 
 ASM_FUNCTION_RISCV_RE = re.compile(
-    r'^_?(?P<func>[^:]+):[ \t]*#+[ \t]*@(?P=func)\n'
+    r'^_?(?P<func>[^:]+):[ \t]*#+[ \t]*@"?(?P=func)"?\n'
     r'(?:\s*\.?L(?P=func)\$local:\n)?'  # optional .L<func>$local: due to -fno-semantic-interposition
     r'(?:\s*\.?Lfunc_begin[^:\n]*:\n)?[^:]*?'
     r'(?P<body>^##?[ \t]+[^:]+:.*?)\s*'
@@ -86,27 +86,27 @@ class string:
     flags=(re.M | re.S))
 
 ASM_FUNCTION_LANAI_RE = re.compile(
-    r'^_?(?P<func>[^:]+):[ \t]*!+[ \t]*@(?P=func)\n'
+    r'^_?(?P<func>[^:]+):[ \t]*!+[ \t]*@"?(?P=func)"?\n'
     r'(?:[ \t]+.cfi_startproc\n)?'  # drop optional cfi noise
     r'(?P<body>.*?)\s*'
     r'.Lfunc_end[0-9]+:\n',
     flags=(re.M | re.S))
 
 ASM_FUNCTION_SPARC_RE = re.compile(
-    r'^_?(?P<func>[^:]+):[ \t]*!+[ \t]*@(?P=func)\n'
+    r'^_?(?P<func>[^:]+):[ \t]*!+[ \t]*@"?(?P=func)"?\n'
     r'(?P<body>.*?)\s*'
     r'.Lfunc_end[0-9]+:\n',
     flags=(re.M | re.S))
 
 ASM_FUNCTION_SYSTEMZ_RE = re.compile(
-    r'^_?(?P<func>[^:]+):[ \t]*#+[ \t]*@(?P=func)\n'
+    r'^_?(?P<func>[^:]+):[ \t]*#+[ \t]*@"?(?P=func)"?\n'
     r'[ \t]+.cfi_startproc\n'
     r'(?P<body>.*?)\n'
     r'.Lfunc_end[0-9]+:\n',
     flags=(re.M | re.S))
 
 ASM_FUNCTION_AARCH64_DARWIN_RE = re.compile(
-     r'^_(?P<func>[^:]+):[ \t]*;[ \t]@(?P=func)\n'
+     r'^_(?P<func>[^:]+):[ \t]*;[ \t]@"?(?P=func)"?\n'
      r'([ \t]*.cfi_startproc\n[\s]*)?'
      r'(?P<body>.*?)'
      r'([ \t]*.cfi_endproc\n[\s]*)?'
@@ -114,7 +114,7 @@ class string:
      flags=(re.M | re.S))
 
 ASM_FUNCTION_ARM_DARWIN_RE = re.compile(
-     r'^[ \t]*\.globl[ \t]*_(?P<func>[^ \t])[ \t]*@[ \t]--[ \t]Begin[ \t]function[ \t](?P=func)'
+     r'^[ \t]*\.globl[ \t]*_(?P<func>[^ \t])[ \t]*@[ \t]--[ \t]Begin[ \t]function[ \t]"?(?P=func)"?'
      r'(?P<directives>.*?)'
      r'^_(?P=func):\n[ \t]*'
      r'(?P<body>.*?)'
@@ -137,7 +137,7 @@ class string:
      flags=(re.M | re.S))
 
 ASM_FUNCTION_WASM32_RE = re.compile(
-    r'^_?(?P<func>[^:]+):[ \t]*#+[ \t]*@(?P=func)\n'
+    r'^_?(?P<func>[^:]+):[ \t]*#+[ \t]*@"?(?P=func)"?\n'
     r'(?P<body>.*?)\n'
     r'^\s*(\.Lfunc_end[0-9]+:\n|end_function)',
     flags=(re.M | re.S))

diff  --git a/llvm/utils/UpdateTestChecks/common.py b/llvm/utils/UpdateTestChecks/common.py
index a1759b40b524..d49fe50e5b1c 100644
--- a/llvm/utils/UpdateTestChecks/common.py
+++ b/llvm/utils/UpdateTestChecks/common.py
@@ -145,16 +145,16 @@ def invoke_tool(exe, cmd_args, ir):
 UTC_ADVERT = 'NOTE: Assertions have been autogenerated by '
 
 OPT_FUNCTION_RE = re.compile(
-    r'^(\s*;\s*Function\sAttrs:\s(?P<attrs>[\w\s]+?))?\s*define\s+(?:internal\s+)?[^@]*@(?P<func>[\w.-]+?)\s*'
+    r'^(\s*;\s*Function\sAttrs:\s(?P<attrs>[\w\s]+?))?\s*define\s+(?:internal\s+)?[^@]*@(?P<func>[\w.$-]+?)\s*'
     r'(?P<args_and_sig>\((\)|(.*?[\w.-]+?)\))[^{]*\{)\n(?P<body>.*?)^\}$',
     flags=(re.M | re.S))
 
 ANALYZE_FUNCTION_RE = re.compile(
-    r'^\s*\'(?P<analysis>[\w\s-]+?)\'\s+for\s+function\s+\'(?P<func>[\w.-]+?)\':'
+    r'^\s*\'(?P<analysis>[\w\s-]+?)\'\s+for\s+function\s+\'(?P<func>[\w.$-]+?)\':'
     r'\s*\n(?P<body>.*)$',
     flags=(re.X | re.S))
 
-IR_FUNCTION_RE = re.compile(r'^\s*define\s+(?:internal\s+)?[^@]*@([\w.-]+)\s*\(')
+IR_FUNCTION_RE = re.compile(r'^\s*define\s+(?:internal\s+)?[^@]*@"?([\w.$-]+)"?\s*\(')
 TRIPLE_IR_RE = re.compile(r'^\s*target\s+triple\s*=\s*"([^"]+)"$')
 TRIPLE_ARG_RE = re.compile(r'-mtriple[= ]([^ ]+)')
 MARCH_ARG_RE = re.compile(r'-march[= ]([^ ]+)')


        


More information about the llvm-commits mailing list