[PATCH] D54889: Fiber support for thread sanitizer

Dmitry Vyukov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 6 06:53:04 PST 2019


dvyukov added a comment.

In D54889#1385149 <https://reviews.llvm.org/D54889#1385149>, @dvyukov wrote:

> Current code runs in 7.16s
>  This change -- 6.23s
>  This change + cur_thread_fast returning cur_thread_placeholder -- 7.01s
>  I also tried this change + FuncEntry using cur_thread_fast -- 6.20s


But if I do:

  INLINE ThreadState *cur_thread_fast() {
    ThreadState* thr;
    __asm__("": "=a"(thr): "a"(&cur_thread_placeholder[0]));
    return thr;
  }

(which is a dirty trick to force compiler to cache address of the tls object in a register) then the program runs 5.94s -- faster than any other options as it takes advantage of both no indirection and faster instructions.

But this is not beneficial for __tsan_read/write functions because caching the address takes a register and these functions are already severely short on registers.


Repository:
  rCRT Compiler Runtime

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D54889/new/

https://reviews.llvm.org/D54889





More information about the llvm-commits mailing list