diff options
author | Kostya Serebryany <kcc@google.com> | 2012-06-28 09:34:41 +0000 |
---|---|---|
committer | Kostya Serebryany <kcc@google.com> | 2012-06-28 09:34:41 +0000 |
commit | 324cbb89f2759fb9ad347bd2af4631e50c39c8f3 (patch) | |
tree | 616617f202be731ff3d13e770a67897f32865309 /lib | |
parent | 0ca9927a71fed311eea7459b4c85c98cc7ed0352 (diff) | |
download | external_llvm-324cbb89f2759fb9ad347bd2af4631e50c39c8f3.zip external_llvm-324cbb89f2759fb9ad347bd2af4631e50c39c8f3.tar.gz external_llvm-324cbb89f2759fb9ad347bd2af4631e50c39c8f3.tar.bz2 |
[asan] set a hard limit on the number of instructions instrumented pear each BB. This is (hopefully temporary) workaround for PR13225
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@159344 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Transforms/Instrumentation/AddressSanitizer.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/Transforms/Instrumentation/AddressSanitizer.cpp b/lib/Transforms/Instrumentation/AddressSanitizer.cpp index 375a2ae..f80c8c4 100644 --- a/lib/Transforms/Instrumentation/AddressSanitizer.cpp +++ b/lib/Transforms/Instrumentation/AddressSanitizer.cpp @@ -82,6 +82,14 @@ static cl::opt<bool> ClInstrumentWrites("asan-instrument-writes", static cl::opt<bool> ClInstrumentAtomics("asan-instrument-atomics", cl::desc("instrument atomic instructions (rmw, cmpxchg)"), cl::Hidden, cl::init(true)); +// This flags limits the number of instructions to be instrumented +// in any given BB. Normally, this should be set to unlimited (INT_MAX), +// but due to http://llvm.org/bugs/show_bug.cgi?id=12652 we temporary +// set it to 10000. +static cl::opt<int> ClMaxInsnsToInstrumentPerBB("asan-max-ins-per-bb", + cl::init(10000), + cl::desc("maximal number of instructions to instrument in any given BB"), + cl::Hidden); // This flag may need to be replaced with -f[no]asan-stack. static cl::opt<bool> ClStack("asan-stack", cl::desc("Handle stack memory"), cl::Hidden, cl::init(true)); @@ -689,6 +697,7 @@ bool AddressSanitizer::handleFunction(Module &M, Function &F) { for (Function::iterator FI = F.begin(), FE = F.end(); FI != FE; ++FI) { TempsToInstrument.clear(); + int NumInsnsPerBB = 0; for (BasicBlock::iterator BI = FI->begin(), BE = FI->end(); BI != BE; ++BI) { if (LooksLikeCodeInBug11395(BI)) return false; @@ -710,6 +719,9 @@ bool AddressSanitizer::handleFunction(Module &M, Function &F) { continue; } ToInstrument.push_back(BI); + NumInsnsPerBB++; + if (NumInsnsPerBB >= ClMaxInsnsToInstrumentPerBB) + break; } } |