Re: [PATCH] D16251: There seems to be a fundamental problem in SimplifyCFG: Dead code removal can result inuninitialized variables. The impact is an “endless” loop which can be consideredthe consequence of searching for the initialization. More details are...

Philip Reames via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 19 11:58:31 PST 2016


reames added a subscriber: reames.
reames added a comment.

I strongly suspect this patch is incorrect as written.  I don't have a particular counter example, but there are many places in SimplifyCFG that modify the CFG in ways that effect dominance information and I don't see enough updates in SimplifyCFG to account for that.

I would suggest focusing on the infinite loop you addressed rather than trying to make SimplifyCFG preserve dominator tree.  I haven't studied the code you mentioned is at fault, but the standard visited set idiom or another approach for stopping infinite recursion seems likely to be much easier to implement.

If you want to go down that route, I'd suggest separating a separate patch series which teaches SimplifyCFG to preserve dominator tree info through all of the updates.  I'll warn you this is going to be a good amount of work though!  You'll probably want a on demand mechanism to force recalc within the pass and then go through each transform one at a time to reduce recalcs.


http://reviews.llvm.org/D16251





More information about the llvm-commits mailing list