1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2025-02-01 05:01:59 +01:00

Zero-Initialize PrevInstBB when entering a new MachineFunction.

It is not guaranteed that the memory used for MachineBasicBlocks in
the previous MachineFunction hasn't been freed, so holding on to a
pointer to the last function's isn't correct. Particularly I have
observed the sret.ll testcase failing because the first BasicBlock in
the new function happened to be allocated to the exact same memory as
the previously saved and (deleted) PrevInstBB.

llvm-svn: 298642
This commit is contained in:
Adrian Prantl 2017-03-23 20:23:42 +00:00
parent 3b70d1973c
commit 223f1362b6

View File

@ -130,6 +130,7 @@ bool hasDebugInfo(const MachineModuleInfo *MMI, const MachineFunction *MF) {
void DebugHandlerBase::beginFunction(const MachineFunction *MF) {
assert(Asm);
PrevInstBB = nullptr;
if (!hasDebugInfo(MMI, MF)) {
skippedNonDebugFunction();