[tsan] Avoid calling Block_copy in the "sync" GCD interceptors
authorKuba Mracek <mracek@apple.com>
Tue, 21 Aug 2018 21:24:22 +0000 (21:24 +0000)
committerKuba Mracek <mracek@apple.com>
Tue, 21 Aug 2018 21:24:22 +0000 (21:24 +0000)
commitfaef7d034a9ec6cb757137adce8e8670ec6c2d7b
treebb480a2da52051a854f6ff66c68474d2cad9312a
parentdf4cd7cbf97c23f363ca07dc4038ecc48c1e6623
[tsan] Avoid calling Block_copy in the "sync" GCD interceptors

The synchronous dispatch functions in GCD (dispatch_sync, dispatch_barrier_sync), don't make a copy of the passed block. To maintain binary compatibility, we should avoid doing that as well in TSan, as there's no reason to do that. The synchronous dispatch functions will not return before the block is actually executed.

rdar://problem/42242579

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

llvm-svn: 340342
compiler-rt/lib/tsan/rtl/tsan_libdispatch_mac.cc
compiler-rt/test/tsan/Darwin/gcd-sync-block-copy.mm [new file with mode: 0644]