summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Instrumentation
diff options
context:
space:
mode:
authorKuba Brecka <kuba.brecka@gmail.com>2015-02-24 09:47:05 +0000
committerKuba Brecka <kuba.brecka@gmail.com>2015-02-24 09:47:05 +0000
commitf5875d3026dd9dd5ca89791615500bde4687c577 (patch)
tree5a46cc2145fad93d3821a77f6cd1345354184425 /llvm/lib/Transforms/Instrumentation
parent4f818708a808d52bca8cf8bdb79a9595268f22bd (diff)
downloadbcm5719-llvm-f5875d3026dd9dd5ca89791615500bde4687c577.tar.gz
bcm5719-llvm-f5875d3026dd9dd5ca89791615500bde4687c577.zip
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
Diffstat (limited to 'llvm/lib/Transforms/Instrumentation')
-rw-r--r--llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp12
1 files changed, 5 insertions, 7 deletions
diff --git a/llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp b/llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp
index 3d14d8f0cfa..882aab0a70d 100644
--- a/llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp
+++ b/llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp
@@ -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();
OpenPOWER on IntegriCloud