[llvm] r298642 - Zero-Initialize PrevInstBB when entering a new MachineFunction.
Adrian Prantl via llvm-commits
llvm-commits at lists.llvm.org
Thu Mar 23 13:23:42 PDT 2017
Author: adrian
Date: Thu Mar 23 15:23:42 2017
New Revision: 298642
URL: http://llvm.org/viewvc/llvm-project?rev=298642&view=rev
Log:
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.
Modified:
llvm/trunk/lib/CodeGen/AsmPrinter/DebugHandlerBase.cpp
Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DebugHandlerBase.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DebugHandlerBase.cpp?rev=298642&r1=298641&r2=298642&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DebugHandlerBase.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DebugHandlerBase.cpp Thu Mar 23 15:23:42 2017
@@ -130,6 +130,7 @@ bool hasDebugInfo(const MachineModuleInf
void DebugHandlerBase::beginFunction(const MachineFunction *MF) {
assert(Asm);
+ PrevInstBB = nullptr;
if (!hasDebugInfo(MMI, MF)) {
skippedNonDebugFunction();
More information about the llvm-commits
mailing list