<div style="font-family: arial, helvetica, sans-serif; font-size: 10pt"><div dir="ltr">Zhou, this patch was never removed. Please do not commit patches without review first. Please revert and ping the review thread.<div><br>
</div><div style>While it might seem like this patch is "obvious" two things make it clear that it is not:</div><div class="gmail_extra"><br><div class="gmail_quote">On Sun, Nov 25, 2012 at 9:45 PM, Zhou Sheng <span dir="ltr"><<a href="mailto:zhousheng00@gmail.com" target="_blank" class="cremed">zhousheng00@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: sheng<br>
Date: Sun Nov 25 23:45:53 2012<br>
New Revision: 168581<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=168581&view=rev" target="_blank" class="cremed">http://llvm.org/viewvc/llvm-project?rev=168581&view=rev</a><br>
Log:<br>
Fix a PassManager pointer use-after-free bug.<br>
The bug can be triggered when we require LoopInfo analysis ahead of DominatorTree construction in a Module Pass.</blockquote><div><br></div><div style>Then you should include a test case which demonstrates the bug under valgrind, or some other use-after-free detection system.</div>
<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">The cause is that the LoopInfo analysis itself also invokes DominatorTree construction, therefore, when PassManager schedules LoopInfo, it will add DominatorTree first. Then after that, when the PassManger turns to schedule DominatorTree invoked by the above ModulePass, it finds there is already a DominatorTree, so it delete the redundant one. However, somehow it still try to access that pass pointer after free as code pasted below, which results in segment fault.<br>
</blockquote><div><br></div><div style>"somehow" isn't a good enough explanation for this fix being the correct fix. You need to actually understand the complete issue. Also, the comments below don't really seem to match your description here.</div>
<div style><br></div><div style><br></div><div style>Anyways, we should take the rest of this to the code review thread, and continue there until the review is complete before committing.</div></div></div></div></div>