diff options
author | Nico Weber <nicolasweber@gmx.de> | 2015-07-21 15:48:53 +0000 |
---|---|---|
committer | Nico Weber <nicolasweber@gmx.de> | 2015-07-21 15:48:53 +0000 |
commit | f00afcc79bd9b2cc4b7c2acba1d1e4202d485a40 (patch) | |
tree | 6cbc169cf2af789866833b96b84bd581840a98d6 /llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp | |
parent | e40677434bc5ccf0ffefa2c9cdf7f07b7863b7ea (diff) | |
download | bcm5719-llvm-f00afcc79bd9b2cc4b7c2acba1d1e4202d485a40.tar.gz bcm5719-llvm-f00afcc79bd9b2cc4b7c2acba1d1e4202d485a40.zip |
Revert 242726, it broke ASan on OS X.
llvm-svn: 242792
Diffstat (limited to 'llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp')
-rw-r--r-- | llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp | 40 |
1 files changed, 0 insertions, 40 deletions
diff --git a/llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp b/llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp index 0c0280a506a..52b2290a938 100644 --- a/llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp +++ b/llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp @@ -439,7 +439,6 @@ struct AddressSanitizer : public FunctionPass { Value *memToShadow(Value *Shadow, IRBuilder<> &IRB); bool runOnFunction(Function &F) override; bool maybeInsertAsanInitAtFunctionEntry(Function &F); - void markEscapedLocalAllocas(Function &F); bool doInitialization(Module &M) override; static char ID; // Pass identification, replacement for typeid @@ -549,7 +548,6 @@ struct FunctionStackPoisoner : public InstVisitor<FunctionStackPoisoner> { SmallVector<AllocaInst *, 1> DynamicAllocaVec; SmallVector<IntrinsicInst *, 1> StackRestoreVec; AllocaInst *DynamicAllocaLayout = nullptr; - IntrinsicInst *LocalEscapeCall = nullptr; // Maps Value to an AllocaInst from which the Value is originated. typedef DenseMap<Value *, AllocaInst *> AllocaForValueMapTy; @@ -647,7 +645,6 @@ struct FunctionStackPoisoner : public InstVisitor<FunctionStackPoisoner> { void visitIntrinsicInst(IntrinsicInst &II) { Intrinsic::ID ID = II.getIntrinsicID(); if (ID == Intrinsic::stackrestore) StackRestoreVec.push_back(&II); - if (ID == Intrinsic::localescape) LocalEscapeCall = &II; if (!ClCheckLifetime) return; if (ID != Intrinsic::lifetime_start && ID != Intrinsic::lifetime_end) return; @@ -1482,34 +1479,6 @@ bool AddressSanitizer::maybeInsertAsanInitAtFunctionEntry(Function &F) { return false; } -void AddressSanitizer::markEscapedLocalAllocas(Function &F) { - // Find the one possible call to llvm.localescape and pre-mark allocas passed - // to it as uninteresting. This assumes we haven't started processing allocas - // yet. This check is done up front because iterating the use list in - // isInterestingAlloca would be algorithmically slower. - assert(ProcessedAllocas.empty() && "must process localescape before allocas"); - - // Try to get the declaration of llvm.localescape. If it's not in the module, - // we can exit early. - if (!F.getParent()->getFunction("llvm.localescape")) return; - - // Look for a call to llvm.localescape call in the entry block. It can't be in - // any other block. - for (Instruction &I : F.getEntryBlock()) { - IntrinsicInst *II = dyn_cast<IntrinsicInst>(&I); - if (II && II->getIntrinsicID() == Intrinsic::localescape) { - // We found a call. Mark all the allocas passed in as uninteresting. - for (Value *Arg : II->arg_operands()) { - AllocaInst *AI = dyn_cast<AllocaInst>(Arg->stripPointerCasts()); - assert(AI && AI->isStaticAlloca() && - "non-static alloca arg to localescape"); - ProcessedAllocas[AI] = false; - } - break; - } - } -} - bool AddressSanitizer::runOnFunction(Function &F) { if (&F == AsanCtorFunction) return false; if (F.getLinkage() == GlobalValue::AvailableExternallyLinkage) return false; @@ -1525,10 +1494,6 @@ bool AddressSanitizer::runOnFunction(Function &F) { if (!ClDebugFunc.empty() && ClDebugFunc != F.getName()) return false; - // We can't instrument allocas used with llvm.localescape. Only static allocas - // can be passed to that intrinsic. - markEscapedLocalAllocas(F); - // We want to instrument every address only once per basic block (unless there // are calls between uses). SmallSet<Value *, 16> TempsToInstrument; @@ -1619,8 +1584,6 @@ bool AddressSanitizer::runOnFunction(Function &F) { DEBUG(dbgs() << "ASAN done instrumenting: " << res << " " << F << "\n"); - ProcessedAllocas.clear(); - return res; } @@ -1782,9 +1745,6 @@ void FunctionStackPoisoner::poisonStack() { // treated as regular stack slots. for (auto *AI : NonInstrumentedStaticAllocaVec) AI->moveBefore(InsBefore); - // If we have a call to llvm.localescape, keep it in the entry block. - if (LocalEscapeCall) LocalEscapeCall->moveBefore(InsBefore); - SmallVector<ASanStackVariableDescription, 16> SVD; SVD.reserve(AllocaVec.size()); for (AllocaInst *AI : AllocaVec) { |