aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Transforms/Instrumentation/SanitizerCoverage.cpp
diff options
context:
space:
mode:
authorReid Kleckner <rnk@google.com>2015-08-14 16:45:42 +0000
committerReid Kleckner <rnk@google.com>2015-08-14 16:45:42 +0000
commita57d0151542c228e36838c0a600c5ec9c05b2ea8 (patch)
tree732d02b3a3951f469c7c60ff5d52f7d2d9167a94 /llvm/lib/Transforms/Instrumentation/SanitizerCoverage.cpp
parent4cceca7c15e256c1e01c3476bab8045955842fbc (diff)
downloadllvm-a57d0151542c228e36838c0a600c5ec9c05b2ea8.zip
llvm-a57d0151542c228e36838c0a600c5ec9c05b2ea8.tar.gz
llvm-a57d0151542c228e36838c0a600c5ec9c05b2ea8.tar.bz2
[sancov] Leave llvm.localescape in the entry block
Summary: Similar to the change we applied to ASan. The same test case works. Reviewers: samsonov Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D11961 llvm-svn: 245067
Diffstat (limited to 'llvm/lib/Transforms/Instrumentation/SanitizerCoverage.cpp')
-rw-r--r--llvm/lib/Transforms/Instrumentation/SanitizerCoverage.cpp12
1 files changed, 4 insertions, 8 deletions
diff --git a/llvm/lib/Transforms/Instrumentation/SanitizerCoverage.cpp b/llvm/lib/Transforms/Instrumentation/SanitizerCoverage.cpp
index b6829ae..8a6ab4b 100644
--- a/llvm/lib/Transforms/Instrumentation/SanitizerCoverage.cpp
+++ b/llvm/lib/Transforms/Instrumentation/SanitizerCoverage.cpp
@@ -438,20 +438,16 @@ void SanitizerCoverageModule::InjectCoverageAtBlock(Function &F, BasicBlock &BB,
if (isa<UnreachableInst>(BB.getTerminator()))
return;
BasicBlock::iterator IP = BB.getFirstInsertionPt(), BE = BB.end();
- // Skip static allocas at the top of the entry block so they don't become
- // dynamic when we split the block. If we used our optimized stack layout,
- // then there will only be one alloca and it will come first.
- for (; IP != BE; ++IP) {
- AllocaInst *AI = dyn_cast<AllocaInst>(IP);
- if (!AI || !AI->isStaticAlloca())
- break;
- }
bool IsEntryBB = &BB == &F.getEntryBlock();
DebugLoc EntryLoc;
if (IsEntryBB) {
if (auto SP = getDISubprogram(&F))
EntryLoc = DebugLoc::get(SP->getScopeLine(), 0, SP);
+ // Keep static allocas and llvm.localescape calls in the entry block. Even
+ // if we aren't splitting the block, it's nice for allocas to be before
+ // calls.
+ IP = PrepareToSplitEntryBlock(BB, IP);
} else {
EntryLoc = IP->getDebugLoc();
}