removeFromParent just unlinks it from the basic block and returns the removed instruction. It does not delete it.<br><br><div class="gmail_quote">On Sun, Jan 20, 2013 at 9:54 PM, David Waggoner <span dir="ltr"><<a href="mailto:mathonnapkins@gmail.com" target="_blank">mathonnapkins@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div><br>Thanks for the suggestion, Duncan.<br><br></div><div>I recently figured out that it had to do with how I was removing the pseudo instruction in my overridden expandPostRAPseudo() implementation.</div>

<br></div><div>// member function's signature<br></div><div>bool TheInstrInfo::expandPostRAPseudo(MachineBasicBlock::iterator p_mi)<br><br></div>// works<br><div><div>bb.erase(p_mi);<br><br></div><div>// produces the assertion / memory leak.<br>

p_mi->removeFromParent();<br></div><div><br></div><div>I should have looked more closely at the targets that implemented expandPostRAPseudo() and saw how they got rid of the pseudo instruction. In particular, the successful line was lifted from bool Mips16InstrInfo::expandPostRAPseudo(...). Some targets don't eliminate the pseudo, but rather reconfigure it to be native.<br>

<br>In any case, I don't quite understand why these two seemingly (to me) equivalent lines of code cause different behavior at run time. For reference, each of my pseudo instructions expands to 2 or more native instructions. p_mi->removeFromParent() seems to be used in other targets ( but not expandPostRAPseudo() ) without issue.... *shrug*.<br>

<br></div><div>Sincerely,<br></div><div>~ MathOnNapkins / David<br></div></div><div><div class="h5"><div dir="ltr"><div class="gmail_extra"><br><br><div class="gmail_quote">On Mon, Jan 14, 2013 at 4:14 AM, Duncan Sands <span dir="ltr"><<a href="mailto:baldrick@free.fr" target="_blank">baldrick@free.fr</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hi David,<div><br>
<br>
> Previously, I had been testing with only one routine per test .ll file, but I<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
thought I'd reached a point where I could test multiple operations at once and<br>
understand the output. The odd part about this is that the likelihood of seeing<br>
the above assertion scales with the number of functions in the .ll file. If I<br>
have one or two functions, I never see it. With three, I see it sporadically.<br>
With four or five, I see it about 80% of the time. I don't understand why it<br>
would only assert some of the time, as the inputs are not changing.<br>
</blockquote>
<br></div>
memory corruption or uninitialized variable maybe?  Try running under valgrind.<br>
<br>
Ciao, Duncan.<br>
<br>
 Could it be<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div>
a problem with my system itself, or perhaps I'm running low on RAM? If anybody<br>
has any insight on how to troubleshoot this kind of problem, i'd be very grateful.<br>
<br>
Also, I have not overriden runOnMachineFunction() in my XXXISelDagToDag.cpp<br>
file, so this is happening somewhat out of my control. Should I attempt to<br>
override it? I noticed that only a couple targets actually override<br>
runOnMachineFunction() for that particular pass (MIPS, I think is one).<br>
<br>
Sincerely,<br>
~MathOnNapkins / Dave<br>
<br>
<br>
<br></div>
______________________________<u></u>_________________<br>
LLVM Developers mailing list<br>
<a href="mailto:LLVMdev@cs.uiuc.edu" target="_blank">LLVMdev@cs.uiuc.edu</a>         <a href="http://llvm.cs.uiuc.edu" target="_blank">http://llvm.cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev" target="_blank">http://lists.cs.uiuc.edu/<u></u>mailman/listinfo/llvmdev</a><br>
<br>
</blockquote>
<br>
______________________________<u></u>_________________<br>
LLVM Developers mailing list<br>
<a href="mailto:LLVMdev@cs.uiuc.edu" target="_blank">LLVMdev@cs.uiuc.edu</a>         <a href="http://llvm.cs.uiuc.edu" target="_blank">http://llvm.cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev" target="_blank">http://lists.cs.uiuc.edu/<u></u>mailman/listinfo/llvmdev</a><br>
</blockquote></div><br></div></div></div></div></div>
<br>_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:LLVMdev@cs.uiuc.edu">LLVMdev@cs.uiuc.edu</a>         <a href="http://llvm.cs.uiuc.edu" target="_blank">http://llvm.cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a><br>
<br></blockquote></div><br><br clear="all"><br>-- <br>~Craig