diff options
author | Kostya Serebryany <kcc@google.com> | 2012-03-14 23:33:24 +0000 |
---|---|---|
committer | Kostya Serebryany <kcc@google.com> | 2012-03-14 23:33:24 +0000 |
commit | 6e590e3f61b101554f97d6ab257c802c9ec49862 (patch) | |
tree | 1766669a6aba9d53ce9524383febaed9601ce6f8 /lib/Transforms/Instrumentation/ThreadSanitizer.cpp | |
parent | a1c45044099cf7fb4a072f1326f164706d5bb2e2 (diff) |
[tsan] use FunctionBlackList
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@152755 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/Instrumentation/ThreadSanitizer.cpp')
-rw-r--r-- | lib/Transforms/Instrumentation/ThreadSanitizer.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/Transforms/Instrumentation/ThreadSanitizer.cpp b/lib/Transforms/Instrumentation/ThreadSanitizer.cpp index d822535f63..85fda30499 100644 --- a/lib/Transforms/Instrumentation/ThreadSanitizer.cpp +++ b/lib/Transforms/Instrumentation/ThreadSanitizer.cpp @@ -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 @@ struct ThreadSanitizer : public FunctionPass { private: TargetData *TD; + OwningPtr<FunctionBlackList> BL; // Callbacks to run-time library are computed in doInitialization. Value *TsanFuncEntry; Value *TsanFuncExit; @@ -76,6 +82,8 @@ bool ThreadSanitizer::doInitialization(Module &M) { 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::doInitialization(Module &M) { 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; |