forked from OSchip/llvm-project
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 llvm-svn: 230316
This commit is contained in:
parent
4f818708a8
commit
f5875d3026
|
@ -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();
|
||||
|
|
Loading…
Reference in New Issue