mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-23 19:23:23 +01:00
[asan] make sure asan erases old unused allocas after it created a new one. This became important after the recent move from ModulePass to FunctionPass because no cleanup is happening after asan pass any more.
llvm-svn: 166267
This commit is contained in:
parent
ac33a84388
commit
83b25ee2df
@ -1148,6 +1148,10 @@ bool AddressSanitizer::poisonStackInFunction(Function &F) {
|
||||
}
|
||||
}
|
||||
|
||||
// We are done. Remove the old unused alloca instructions.
|
||||
for (size_t i = 0, n = AllocaVec.size(); i < n; i++)
|
||||
AllocaVec[i]->eraseFromParent();
|
||||
|
||||
if (ClDebugStack) {
|
||||
DEBUG(dbgs() << F);
|
||||
}
|
||||
|
@ -69,3 +69,23 @@ entry:
|
||||
store i32 42, i32* %a
|
||||
ret void
|
||||
}
|
||||
|
||||
; Check that asan leaves just one alloca.
|
||||
|
||||
declare void @alloca_test_use([10 x i8]*)
|
||||
define void @alloca_test() address_safety {
|
||||
entry:
|
||||
%x = alloca [10 x i8], align 1
|
||||
%y = alloca [10 x i8], align 1
|
||||
%z = alloca [10 x i8], align 1
|
||||
call void @alloca_test_use([10 x i8]* %x)
|
||||
call void @alloca_test_use([10 x i8]* %y)
|
||||
call void @alloca_test_use([10 x i8]* %z)
|
||||
ret void
|
||||
}
|
||||
|
||||
; CHECK: define void @alloca_test()
|
||||
; CHECK: = alloca
|
||||
; CHECK-NOT: = alloca
|
||||
; CHECK: ret void
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user