Fix alloca_instruments_all_paddings.cc test to work under higher -O levels (llvm part)

When AddressSanitizer only a single dynamic alloca and no static allocas, due to an early exit from FunctionStackPoisoner::poisonStack we forget to unpoison the dynamic alloca.  This patch fixes that.

Reviewed at http://reviews.llvm.org/D7810



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@230316 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Kuba Brecka 2015-02-24 09:47:05 +00:00
parent c3b9d471f6
commit 81dce4c02c

View File

@ -1644,10 +1644,13 @@ Value *FunctionStackPoisoner::createAllocaForLayout(
void FunctionStackPoisoner::poisonStack() {
assert(AllocaVec.size() > 0 || DynamicAllocaVec.size() > 0);
if (ClInstrumentAllocas)
if (ClInstrumentAllocas) {
// Handle dynamic allocas.
for (auto &AllocaCall : DynamicAllocaVec)
for (auto &AllocaCall : DynamicAllocaVec) {
handleDynamicAllocaCall(AllocaCall);
unpoisonDynamicAlloca(AllocaCall);
}
}
if (AllocaVec.size() == 0) return;
@ -1826,11 +1829,6 @@ void FunctionStackPoisoner::poisonStack() {
}
}
if (ClInstrumentAllocas)
// Unpoison dynamic allocas.
for (auto &AllocaCall : DynamicAllocaVec)
unpoisonDynamicAlloca(AllocaCall);
// We are done. Remove the old unused alloca instructions.
for (auto AI : AllocaVec)
AI->eraseFromParent();