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

via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 5 00:48:06 PDT 2025


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

RISC-V has looser execution ordering; relax CHECK-NEXT to CHECK

>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] 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
 }



More information about the llvm-commits mailing list