[all-commits] [llvm/llvm-project] 7b4cc0: [TSAN] Handle musttail call properly in EscapeEnum...
Xun Li via All-commits
all-commits at lists.llvm.org
Tue Sep 15 15:21:01 PDT 2020
Branch: refs/heads/master
Home: https://github.com/llvm/llvm-project
Commit: 7b4cc0961b142877794645576d2393af43c48069
https://github.com/llvm/llvm-project/commit/7b4cc0961b142877794645576d2393af43c48069
Author: Xun Li <xun at fb.com>
Date: 2020-09-15 (Tue, 15 Sep 2020)
Changed paths:
M llvm/lib/Transforms/Utils/EscapeEnumerator.cpp
A llvm/test/Instrumentation/ThreadSanitizer/tsan_musttail.ll
Log Message:
-----------
[TSAN] Handle musttail call properly in EscapeEnumerator (and TSAN)
Call instructions with musttail tag must be optimized as a tailcall, otherwise could lead to incorrect program behavior.
When TSAN is instrumenting functions, it broke the contract by adding a call to the tsan exit function inbetween the musttail call and return instruction, and also inserted exception handling code.
This happend throguh EscapeEnumerator, which adds exception handling code and returns ret instructions as the place to insert instrumentation calls.
This becomes especially problematic for coroutines, because coroutines rely on tail calls to do symmetric transfers properly.
To fix this, this patch moves the location to insert instrumentation calls prior to the musttail call for ret instructions that are following musttail calls, and also does not handle exception for musttail calls.
Differential Revision: https://reviews.llvm.org/D87620
More information about the All-commits
mailing list