I really hope that we won't need it. <div>Let's keep it as is for now. </div><div>Also, we may end up with a completely different implementation of the blacklist (see Chandler's reply to my other commit). </div>
<div><br></div><div>--kcc <br><div><br><div class="gmail_quote">On Thu, Mar 15, 2012 at 1:32 AM, Alexander Potapenko <span dir="ltr"><<a href="mailto:glider@google.com">glider@google.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
WDYT about matching the blacklist to inlined function names, like in TSan v1?<br>
<a href="http://code.google.com/p/data-race-test/source/browse/trunk/llvm/opt/ThreadSanitizer/ThreadSanitizer.cpp#1932" target="_blank">http://code.google.com/p/data-race-test/source/browse/trunk/llvm/opt/ThreadSanitizer/ThreadSanitizer.cpp#1932</a><br>
<div class="HOEnZb"><div class="h5"><br>
On Thu, Mar 15, 2012 at 3:33 AM, Kostya Serebryany <<a href="mailto:kcc@google.com">kcc@google.com</a>> wrote:<br>
> Author: kcc<br>
> Date: Wed Mar 14 18:33:24 2012<br>
> New Revision: 152755<br>
><br>
> URL: <a href="http://llvm.org/viewvc/llvm-project?rev=152755&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=152755&view=rev</a><br>
> Log:<br>
> [tsan] use FunctionBlackList<br>
><br>
> Modified:<br>
> llvm/trunk/lib/Transforms/Instrumentation/ThreadSanitizer.cpp<br>
><br>
> Modified: llvm/trunk/lib/Transforms/Instrumentation/ThreadSanitizer.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Instrumentation/ThreadSanitizer.cpp?rev=152755&r1=152754&r2=152755&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Instrumentation/ThreadSanitizer.cpp?rev=152755&r1=152754&r2=152755&view=diff</a><br>
> ==============================================================================<br>
> --- llvm/trunk/lib/Transforms/Instrumentation/ThreadSanitizer.cpp (original)<br>
> +++ llvm/trunk/lib/Transforms/Instrumentation/ThreadSanitizer.cpp Wed Mar 14 18:33:24 2012<br>
> @@ -21,12 +21,14 @@<br>
><br>
> #define DEBUG_TYPE "tsan"<br>
><br>
> +#include "FunctionBlackList.h"<br>
> #include "llvm/ADT/SmallString.h"<br>
> #include "llvm/ADT/SmallVector.h"<br>
> #include "llvm/ADT/StringExtras.h"<br>
> #include "llvm/Intrinsics.h"<br>
> #include "llvm/Function.h"<br>
> #include "llvm/Module.h"<br>
> +#include "llvm/Support/CommandLine.h"<br>
> #include "llvm/Support/Debug.h"<br>
> #include "llvm/Support/IRBuilder.h"<br>
> #include "llvm/Support/MathExtras.h"<br>
> @@ -37,6 +39,9 @@<br>
><br>
> using namespace llvm;<br>
><br>
> +static cl::opt<std::string> ClBlackListFile("tsan-blacklist",<br>
> + cl::desc("Blacklist file"), cl::Hidden);<br>
> +<br>
> namespace {<br>
> /// ThreadSanitizer: instrument the code in module to find races.<br>
> struct ThreadSanitizer : public FunctionPass {<br>
> @@ -48,6 +53,7 @@<br>
><br>
> private:<br>
> TargetData *TD;<br>
> + OwningPtr<FunctionBlackList> BL;<br>
> // Callbacks to run-time library are computed in doInitialization.<br>
> Value *TsanFuncEntry;<br>
> Value *TsanFuncExit;<br>
> @@ -76,6 +82,8 @@<br>
> TD = getAnalysisIfAvailable<TargetData>();<br>
> if (!TD)<br>
> return false;<br>
> + BL.reset(new FunctionBlackList(ClBlackListFile));<br>
> +<br>
> // Always insert a call to __tsan_init into the module's CTORs.<br>
> IRBuilder<> IRB(M.getContext());<br>
> Value *TsanInit = M.getOrInsertFunction("__tsan_init",<br>
> @@ -102,6 +110,7 @@<br>
><br>
> bool ThreadSanitizer::runOnFunction(Function &F) {<br>
> if (!TD) return false;<br>
> + if (BL->isIn(F)) return false;<br>
> SmallVector<Instruction*, 8> RetVec;<br>
> SmallVector<Instruction*, 8> LoadsAndStores;<br>
> bool Res = false;<br>
><br>
><br>
> _______________________________________________<br>
> llvm-commits mailing list<br>
> <a href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</a><br>
> <a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><br>
<br>
<br>
<br>
</div></div><span class="HOEnZb"><font color="#888888">--<br>
Alexander Potapenko<br>
Software Engineer<br>
Google Moscow<br>
</font></span></blockquote></div><br></div></div>