[PATCH] D54889: Fiber support for thread sanitizer

Dmitry Vyukov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 7 06:09:58 PST 2019


dvyukov added a comment.

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

> 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.


This is looked like an interesting optimization, but turns out to be too sensitive to unrelated code changes. 
With a slightly changed benchmark:
http://llvm.org/viewvc/llvm-project?view=revision&revision=353407
This change shows ~2% slowdown instead: from 6s to 6.15s.


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