[PATCH] D19001: [ppc64] Disable sibling-call-optimization when building tsan library by clang

Hal Finkel via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 14 07:28:28 PDT 2016


hfinkel added a comment.

In http://reviews.llvm.org/D19001#400915, @cycheng wrote:

> Agree!
>
> 1. First, I would like to update my investigations:
>   - Current mechanism of "BufferedStackTrace::LocatePcInTrace and MatchPc" is unable to handle tail-call to "__tsan::PrintCurrentStackSlow" case.
>   - I used clang 3.9.0 on x86 to build tsan library, of course it tail-call to  "__tsan::PrintCurrentStackSlow", and I found it passed print-stack-trace.cc test was because of lucky. see: https://llvm.org/bugs/show_bug.cgi?id=27280#c3
>   - Possible solutions:
>     1. Use "always_inline" attribute on "__tsan::PrintCurrentStackSlow"
>     2. New mechanism? I'm still thinking @@
> 2. No, the threshold does not affect runtime, but it **depend on compiler's codegen decision**, I feel it is a magic number, use large number can cause poping incorrect stack count.


If adding always_inline to `__tsan::PrintCurrentStackSlow` will fix the problem, that sounds like the best solution (as it will work across compilers). I suggest proposing a patch adding that attribute (and adding a comment explaining why the function must be always_inline).


http://reviews.llvm.org/D19001





More information about the llvm-commits mailing list