[compiler-rt] Relax CHECK-NEXT to CHECK for RISC-V (PR #157039)

via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 19 08:56:50 PDT 2025


https://github.com/julianmorillo updated https://github.com/llvm/llvm-project/pull/157039

>From d616f42b812cd1cf005bf5bf6362fff1395f19bf Mon Sep 17 00:00:00 2001
From: Julian Morillo <julian.morillo at bsc.es>
Date: Fri, 5 Sep 2025 09:46:37 +0200
Subject: [PATCH 1/2] Relax CHECK-NEXT to CHECK for RISC-V

---
 .../TestCases/Posix/patching-unpatching.cpp   | 26 +++++++++++++++++++
 1 file changed, 26 insertions(+)

diff --git a/compiler-rt/test/xray/TestCases/Posix/patching-unpatching.cpp b/compiler-rt/test/xray/TestCases/Posix/patching-unpatching.cpp
index a8a820bbe45f2..2a95ba0e3aa65 100644
--- a/compiler-rt/test/xray/TestCases/Posix/patching-unpatching.cpp
+++ b/compiler-rt/test/xray/TestCases/Posix/patching-unpatching.cpp
@@ -26,6 +26,31 @@ void test_handler(int32_t fid, XRayEntryType type) {
 int main() {
   __xray_set_handler(test_handler);
   always_instrument();
+#if defined(__riscv)
+  // RISC-V has looser execution ordering; relax CHECK-NEXT to CHECK
+  // CHECK: always instrumented called
+  auto status = __xray_patch();
+  printf("patching status: %d\n", static_cast<int32_t>(status));
+  // CHECK-NEXT: patching status: 1
+  always_instrument();
+  // CHECK: called: {{.*}}, type=0
+  // CHECK: always instrumented called
+  // CHECK: called: {{.*}}, type=1
+  status = __xray_unpatch();
+  printf("patching status: %d\n", static_cast<int32_t>(status));
+  // CHECK: patching status: 1
+  always_instrument();
+  // CHECK: always instrumented called
+  status = __xray_patch();
+  printf("patching status: %d\n", static_cast<int32_t>(status));
+  // CHECK: patching status: 1
+  __xray_remove_handler();
+  always_instrument();
+  // CHECK: always instrumented called
+  status = __xray_unpatch();
+  printf("patching status: %d\n", static_cast<int32_t>(status));
+  // CHECK: patching status: 1
+#else
   // CHECK: always instrumented called
   auto status = __xray_patch();
   printf("patching status: %d\n", static_cast<int32_t>(status));
@@ -48,4 +73,5 @@ int main() {
   status = __xray_unpatch();
   printf("patching status: %d\n", static_cast<int32_t>(status));
   // CHECK-NEXT: patching status: 1
+#endif
 }

>From e3e1e7d6d0d345e1f63c21c9163c9ebafd3058f4 Mon Sep 17 00:00:00 2001
From: julianmorillo <julianmorillo at users.noreply.github.com>
Date: Fri, 19 Sep 2025 17:56:41 +0200
Subject: [PATCH 2/2] Update patching-unpatching.cpp

---
 compiler-rt/test/xray/TestCases/Posix/patching-unpatching.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/compiler-rt/test/xray/TestCases/Posix/patching-unpatching.cpp b/compiler-rt/test/xray/TestCases/Posix/patching-unpatching.cpp
index 2a95ba0e3aa65..2bd85e8cc570d 100644
--- a/compiler-rt/test/xray/TestCases/Posix/patching-unpatching.cpp
+++ b/compiler-rt/test/xray/TestCases/Posix/patching-unpatching.cpp
@@ -35,7 +35,7 @@ int main() {
   always_instrument();
   // CHECK: called: {{.*}}, type=0
   // CHECK: always instrumented called
-  // CHECK: called: {{.*}}, type=1
+  // CHECK-NEXT: called: {{.*}}, type=1
   status = __xray_unpatch();
   printf("patching status: %d\n", static_cast<int32_t>(status));
   // CHECK: patching status: 1



More information about the llvm-commits mailing list