[compiler-rt] f8f1bb7 - [compiler-rt][lsan] Add backup AArch64 register for use_registers test

David Spickett via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 6 01:45:58 PDT 2021


Author: David Spickett
Date: 2021-10-06T09:45:53+01:00
New Revision: f8f1bb7462bf2924ac78e9f22356228356fd5219

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

LOG: [compiler-rt][lsan] Add backup AArch64 register for use_registers test

On Ubuntu Focal x13 is used by something in the process of calling
sched_yield. Causing the test to fail depending on when the thread
is stopped.

Adding x14 works around this and the test passes consistently.

Not switching to only x14 because that could make other platforms
fail. With both we'll always find at least one and even if both
values are present we'll only get one report.

Reviewed By: oontvoo, vitalybuka

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

Added: 
    

Modified: 
    compiler-rt/test/lsan/TestCases/use_registers.cpp

Removed: 
    


################################################################################
diff  --git a/compiler-rt/test/lsan/TestCases/use_registers.cpp b/compiler-rt/test/lsan/TestCases/use_registers.cpp
index 7f431056d0643..358ec580fe1c0 100644
--- a/compiler-rt/test/lsan/TestCases/use_registers.cpp
+++ b/compiler-rt/test/lsan/TestCases/use_registers.cpp
@@ -37,9 +37,11 @@ extern "C" void *registers_thread_func(void *arg) {
       :
       : "r"(p));
 #elif defined(__aarch64__)
-  // x9-10are used. x11-12 are probably used.
-  // So we pick x13 to be safe.
-  asm("mov x13, %0"
+  // x9-10 are used. x11-12 are probably used.
+  // So we pick x13 to be safe and x14 as a backup.
+  // (x13 known to be used on Ubuntu Focal)
+  asm("mov x13, %0\n"
+      "mov x14, %0"
       :
       : "r"(p));
 #elif defined(__powerpc__)


        


More information about the llvm-commits mailing list