diff options
author | Vitaly Buka <vitalybuka@google.com> | 2016-07-28 22:50:45 +0000 |
---|---|---|
committer | Vitaly Buka <vitalybuka@google.com> | 2016-07-28 22:50:45 +0000 |
commit | 36457938725a34da13936a0e1eead7cc2147b0a2 (patch) | |
tree | 1a08d28378f52dec65921c59b3a2c5d01918b522 /llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp | |
parent | caca9da4ff3ae314a522e1eaa9ed2ece852ebfc6 (diff) | |
download | bcm5719-llvm-36457938725a34da13936a0e1eead7cc2147b0a2.tar.gz bcm5719-llvm-36457938725a34da13936a0e1eead7cc2147b0a2.zip |
maned
llvm-svn: 277067
Diffstat (limited to 'llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp')
-rw-r--r-- | llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp b/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp index c78f105523c..5446ce0f04f 100644 --- a/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp +++ b/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp @@ -1211,10 +1211,6 @@ static bool removeTriviallyEmptyRange(IntrinsicInst &I, unsigned StartID, unsigned EndID, InstCombiner &IC) { assert(I.getIntrinsicID() == StartID && "Start intrinsic does not have expected ID"); - // Even if the range is empty asan need to poison memory to detect invalid - // access latter. - if (ClUseAfterScope) - return false; BasicBlock::iterator BI(I), BE(I.getParent()->end()); for (++BI; BI != BE; ++BI) { if (auto *E = dyn_cast<IntrinsicInst>(BI)) { @@ -2248,11 +2244,18 @@ Instruction *InstCombiner::visitCallInst(CallInst &CI) { return eraseInstFromFunction(CI); break; } - case Intrinsic::lifetime_start: + case Intrinsic::lifetime_start: { + const Function *func = II->getFunction(); + // Asan needs to poison memory to detect invalid access possible even for + // empty lifetime range. + if (func && func->hasFnAttribute(Attribute::SanitizeAddress)) + break; + if (removeTriviallyEmptyRange(*II, Intrinsic::lifetime_start, Intrinsic::lifetime_end, *this)) return nullptr; break; + } case Intrinsic::assume: { Value *IIOperand = II->getArgOperand(0); // Remove an assume if it is immediately followed by an identical assume. @@ -2483,7 +2486,6 @@ static IntrinsicInst *findInitTrampoline(Value *Callee) { /// Improvements for call and invoke instructions. Instruction *InstCombiner::visitCallSite(CallSite CS) { - if (isAllocLikeFn(CS.getInstruction(), TLI)) return visitAllocSite(*CS.getInstruction()); |