mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-02-01 05:01:59 +01:00
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
554fe54ab0
commit
fda2cdf0bc
@ -1644,10 +1644,13 @@ Value *FunctionStackPoisoner::createAllocaForLayout(
|
|||||||
void FunctionStackPoisoner::poisonStack() {
|
void FunctionStackPoisoner::poisonStack() {
|
||||||
assert(AllocaVec.size() > 0 || DynamicAllocaVec.size() > 0);
|
assert(AllocaVec.size() > 0 || DynamicAllocaVec.size() > 0);
|
||||||
|
|
||||||
if (ClInstrumentAllocas)
|
if (ClInstrumentAllocas) {
|
||||||
// Handle dynamic allocas.
|
// Handle dynamic allocas.
|
||||||
for (auto &AllocaCall : DynamicAllocaVec)
|
for (auto &AllocaCall : DynamicAllocaVec) {
|
||||||
handleDynamicAllocaCall(AllocaCall);
|
handleDynamicAllocaCall(AllocaCall);
|
||||||
|
unpoisonDynamicAlloca(AllocaCall);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (AllocaVec.size() == 0) return;
|
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.
|
// We are done. Remove the old unused alloca instructions.
|
||||||
for (auto AI : AllocaVec)
|
for (auto AI : AllocaVec)
|
||||||
AI->eraseFromParent();
|
AI->eraseFromParent();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user