[llvm] r217260 - Set the parent pointer of cloned DBG_VALUE instructions correctly.
dblaikie at gmail.com
Fri Sep 5 10:31:48 PDT 2014
On Sep 5, 2014 10:22 AM, "Adrian Prantl" <aprantl at apple.com> wrote:
> Author: adrian
> Date: Fri Sep 5 12:10:10 2014
> New Revision: 217260
> URL: http://llvm.org/viewvc/llvm-project?rev=217260&view=rev
> Set the parent pointer of cloned DBG_VALUE instructions correctly.
> Fixes PR20523.
> When spilling variables onto the stack, spillVirtReg() is setting the
> parent pointer of the cloned DBG_VALUE intrinsic for the stack location
> to the parent pointer of the original intrinsic. MachineInstr parent
> pointers should however always point to the parent basic block.
> MBB is shadowing the MBB member variable. The instruction still ends up
> being inserted into the right basic block, because it's inserted after MI
> which serves as the iterator.
Perhaps we should assert that the iterator within the basic block?
> I failed at constructing a reliable testcase for this, see
> http://llvm.org/bugs/show_bug.cgi?id=20523 for a large testcases.
> Modified: llvm/trunk/lib/CodeGen/RegAllocFast.cpp
> --- llvm/trunk/lib/CodeGen/RegAllocFast.cpp (original)
> +++ llvm/trunk/lib/CodeGen/RegAllocFast.cpp Fri Sep 5 12:10:10 2014
> @@ -309,10 +309,10 @@ void RAFast::spillVirtReg(MachineBasicBl
> DL = (--EI)->getDebugLoc();
> } else
> DL = MI->getDebugLoc();
> - MachineBasicBlock *MBB = DBG->getParent();
> MachineInstr *NewDV =
> BuildMI(*MBB, MI, DL, TII->get(TargetOpcode::DBG_VALUE))
> + assert(NewDV->getParent() == MBB && "dangling parent pointer");
Maybe this assertion (in some form) could be moved into a more central
location so this invariant (that BuildMI functions are passed an iterator
into the same MBB - but maybe even below the build function, in the
> DEBUG(dbgs() << "Inserting debug info due to spill:" << "\n" <<
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the llvm-commits