[compiler-rt] 1834660 - [nfc][lsan] Replace `suspended_threads.GetThreadID(i)` with local var (#112607)

via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 16 16:40:26 PDT 2024


Author: Vitaly Buka
Date: 2024-10-16T16:40:24-07:00
New Revision: 1834660b4ca79ae75b2bf9fd157f3ca6957bae0c

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

LOG: [nfc][lsan] Replace `suspended_threads.GetThreadID(i)` with local var (#112607)

Added: 
    

Modified: 
    compiler-rt/lib/lsan/lsan_common.cpp

Removed: 
    


################################################################################
diff  --git a/compiler-rt/lib/lsan/lsan_common.cpp b/compiler-rt/lib/lsan/lsan_common.cpp
index 8cdc6d1651f183..329e29477d0723 100644
--- a/compiler-rt/lib/lsan/lsan_common.cpp
+++ b/compiler-rt/lib/lsan/lsan_common.cpp
@@ -405,7 +405,7 @@ static void ProcessThreads(SuspendedThreadsList const &suspended_threads,
   InternalMmapVector<uptr> registers;
   InternalMmapVector<Range> extra_ranges;
   for (uptr i = 0; i < suspended_threads.ThreadCount(); i++) {
-    tid_t os_id = static_cast<tid_t>(suspended_threads.GetThreadID(i));
+    const tid_t os_id = static_cast<tid_t>(suspended_threads.GetThreadID(i));
     LOG_THREADS("Processing thread %llu.\n", os_id);
     uptr stack_begin, stack_end, tls_begin, tls_end, cache_begin, cache_end;
     DTLS *dtls;
@@ -429,9 +429,8 @@ static void ProcessThreads(SuspendedThreadsList const &suspended_threads,
         continue;
       sp = stack_begin;
     }
-    if (suspended_threads.GetThreadID(i) == caller_tid) {
+    if (os_id == caller_tid)
       sp = caller_sp;
-    }
 
     if (flags()->use_registers && have_registers) {
       uptr registers_begin = reinterpret_cast<uptr>(registers.data());


        


More information about the llvm-commits mailing list