Fix a PassManager pointer use-after-free bug.
authorZhou Sheng <zhousheng00@gmail.com>
Mon, 26 Nov 2012 05:45:53 +0000 (05:45 +0000)
committerZhou Sheng <zhousheng00@gmail.com>
Mon, 26 Nov 2012 05:45:53 +0000 (05:45 +0000)
commitc1cf629e41313a5193e0cccee1c39c7c0e1207f7
tree8983290de8bf4d85b00c4c4794e1bb146548de40
parent604937d1cc05a349e49a885cde9bb093ba8de937
Fix a PassManager pointer use-after-free bug.
The bug can be triggered when we require LoopInfo analysis ahead of DominatorTree construction in a Module Pass. 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.

llvm-svn: 168581
llvm/lib/VMCore/PassManager.cpp