[asan] remove old experimental code

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222586 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Kostya Serebryany 2014-11-21 22:34:29 +00:00
parent 739dfb1a0e
commit 57cd7cd77a
2 changed files with 0 additions and 61 deletions

View File

@ -162,19 +162,6 @@ static cl::opt<std::string> ClMemoryAccessCallbackPrefix(
static cl::opt<bool> ClInstrumentAllocas("asan-instrument-allocas",
cl::desc("instrument dynamic allocas"), cl::Hidden, cl::init(false));
// This is an experimental feature that will allow to choose between
// instrumented and non-instrumented code at link-time.
// If this option is on, just before instrumenting a function we create its
// clone; if the function is not changed by asan the clone is deleted.
// If we end up with a clone, we put the instrumented function into a section
// called "ASAN" and the uninstrumented function into a section called "NOASAN".
//
// This is still a prototype, we need to figure out a way to keep two copies of
// a function so that the linker can easily choose one of them.
static cl::opt<bool> ClKeepUninstrumented("asan-keep-uninstrumented-functions",
cl::desc("Keep uninstrumented copies of functions"),
cl::Hidden, cl::init(false));
// These flags allow to change the shadow mapping.
// The shadow mapping looks like
// Shadow = (Mem >> scale) + (1 << offset_log)
@ -1425,17 +1412,6 @@ bool AddressSanitizer::runOnFunction(Function &F) {
}
}
Function *UninstrumentedDuplicate = nullptr;
bool LikelyToInstrument =
!NoReturnCalls.empty() || !ToInstrument.empty() || (NumAllocas > 0);
if (ClKeepUninstrumented && LikelyToInstrument) {
ValueToValueMapTy VMap;
UninstrumentedDuplicate = CloneFunction(&F, VMap, false);
UninstrumentedDuplicate->removeFnAttr(Attribute::SanitizeAddress);
UninstrumentedDuplicate->setName("NOASAN_" + F.getName());
F.getParent()->getFunctionList().push_back(UninstrumentedDuplicate);
}
bool UseCalls = false;
if (ClInstrumentationWithCallsThreshold >= 0 &&
ToInstrument.size() > (unsigned)ClInstrumentationWithCallsThreshold)
@ -1473,20 +1449,6 @@ bool AddressSanitizer::runOnFunction(Function &F) {
DEBUG(dbgs() << "ASAN done instrumenting: " << res << " " << F << "\n");
if (ClKeepUninstrumented) {
if (!res) {
// No instrumentation is done, no need for the duplicate.
if (UninstrumentedDuplicate)
UninstrumentedDuplicate->eraseFromParent();
} else {
// The function was instrumented. We must have the duplicate.
assert(UninstrumentedDuplicate);
UninstrumentedDuplicate->setSection("NOASAN");
assert(!F.hasSection());
F.setSection("ASAN");
}
}
return res;
}

View File

@ -1,23 +0,0 @@
; Test the -asan-keep-uninstrumented-functions flag: FOO should get cloned
; RUN: opt < %s -asan -asan-module -asan-keep-uninstrumented-functions -S | FileCheck %s
target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"
@a = global i32 0, align 4
define i32 @main() sanitize_address {
entry:
tail call void @FOO(i32* @a)
ret i32 0
}
define void @FOO(i32* nocapture %x) sanitize_address {
entry:
store i32 1, i32* %x, align 4
ret void
}
; main should not be cloned since it is not being instrumented by asan.
; CHECK-NOT: NOASAN_main
; CHECK: define void @FOO{{.*}} section "ASAN"
; CHECK: define void @NOASAN_FOO{{.*}} section "NOASAN"