From: Adrian Prantl Date: Thu, 23 Mar 2017 20:23:42 +0000 (+0000) Subject: Zero-Initialize PrevInstBB when entering a new MachineFunction. X-Git-Tag: llvmorg-5.0.0-rc1~9307 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=8f3337950e88ae7934ffda13f15f1b9dc7e6a9a5;p=platform%2Fupstream%2Fllvm.git 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 --- diff --git a/llvm/lib/CodeGen/AsmPrinter/DebugHandlerBase.cpp b/llvm/lib/CodeGen/AsmPrinter/DebugHandlerBase.cpp index aa8b8fb..1d63e33 100644 --- a/llvm/lib/CodeGen/AsmPrinter/DebugHandlerBase.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/DebugHandlerBase.cpp @@ -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();