Hi All,<br><br>The attached patch fixes a PassManager pointer use-after-free bug. Please kindly let me know if the patch is good to commit.<br>The bug can be triggered when we require LoopInfo analysis ahead of DominatorTree construction in a Module Pass. <br>


The cause is that the LoopInfo analysis itself also invokes 
DominatorTree construction, therefore, when PassManager schedules 
LoopInfo, it will add DominatorTree first.<br>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.<br>
However, somehow it still try to access that pass pointer after free as code pasted below, which results in segment fault.<br><br>Also attached the test case to repeat the issue.<br><br><br>Thanks,<br>Sheng<br>