[llvm-commits] [llvm] r152755 - /llvm/trunk/lib/Transforms/Instrumentation/ThreadSanitizer.cpp

Kostya Serebryany kcc at google.com
Thu Mar 15 09:17:09 PDT 2012


I really hope that we won't need it.
Let's keep it as is for now.
Also, we may end up with a completely different implementation of the
blacklist (see Chandler's reply to my other commit).

--kcc

On Thu, Mar 15, 2012 at 1:32 AM, Alexander Potapenko <glider at google.com>wrote:

> WDYT about matching the blacklist to inlined function names, like in TSan
> v1?
>
> http://code.google.com/p/data-race-test/source/browse/trunk/llvm/opt/ThreadSanitizer/ThreadSanitizer.cpp#1932
>
> On Thu, Mar 15, 2012 at 3:33 AM, Kostya Serebryany <kcc at google.com> wrote:
> > Author: kcc
> > Date: Wed Mar 14 18:33:24 2012
> > New Revision: 152755
> >
> > URL: http://llvm.org/viewvc/llvm-project?rev=152755&view=rev
> > Log:
> > [tsan] use FunctionBlackList
> >
> > Modified:
> >    llvm/trunk/lib/Transforms/Instrumentation/ThreadSanitizer.cpp
> >
> > Modified: llvm/trunk/lib/Transforms/Instrumentation/ThreadSanitizer.cpp
> > URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Instrumentation/ThreadSanitizer.cpp?rev=152755&r1=152754&r2=152755&view=diff
> >
> ==============================================================================
> > --- llvm/trunk/lib/Transforms/Instrumentation/ThreadSanitizer.cpp
> (original)
> > +++ llvm/trunk/lib/Transforms/Instrumentation/ThreadSanitizer.cpp Wed
> Mar 14 18:33:24 2012
> > @@ -21,12 +21,14 @@
> >
> >  #define DEBUG_TYPE "tsan"
> >
> > +#include "FunctionBlackList.h"
> >  #include "llvm/ADT/SmallString.h"
> >  #include "llvm/ADT/SmallVector.h"
> >  #include "llvm/ADT/StringExtras.h"
> >  #include "llvm/Intrinsics.h"
> >  #include "llvm/Function.h"
> >  #include "llvm/Module.h"
> > +#include "llvm/Support/CommandLine.h"
> >  #include "llvm/Support/Debug.h"
> >  #include "llvm/Support/IRBuilder.h"
> >  #include "llvm/Support/MathExtras.h"
> > @@ -37,6 +39,9 @@
> >
> >  using namespace llvm;
> >
> > +static cl::opt<std::string>  ClBlackListFile("tsan-blacklist",
> > +       cl::desc("Blacklist file"), cl::Hidden);
> > +
> >  namespace {
> >  /// ThreadSanitizer: instrument the code in module to find races.
> >  struct ThreadSanitizer : public FunctionPass {
> > @@ -48,6 +53,7 @@
> >
> >  private:
> >   TargetData *TD;
> > +  OwningPtr<FunctionBlackList> BL;
> >   // Callbacks to run-time library are computed in doInitialization.
> >   Value *TsanFuncEntry;
> >   Value *TsanFuncExit;
> > @@ -76,6 +82,8 @@
> >   TD = getAnalysisIfAvailable<TargetData>();
> >   if (!TD)
> >     return false;
> > +  BL.reset(new FunctionBlackList(ClBlackListFile));
> > +
> >   // Always insert a call to __tsan_init into the module's CTORs.
> >   IRBuilder<> IRB(M.getContext());
> >   Value *TsanInit = M.getOrInsertFunction("__tsan_init",
> > @@ -102,6 +110,7 @@
> >
> >  bool ThreadSanitizer::runOnFunction(Function &F) {
> >   if (!TD) return false;
> > +  if (BL->isIn(F)) return false;
> >   SmallVector<Instruction*, 8> RetVec;
> >   SmallVector<Instruction*, 8> LoadsAndStores;
> >   bool Res = false;
> >
> >
> > _______________________________________________
> > llvm-commits mailing list
> > llvm-commits at cs.uiuc.edu
> > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
>
>
> --
> Alexander Potapenko
> Software Engineer
> Google Moscow
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20120315/d7aa6c73/attachment.html>


More information about the llvm-commits mailing list