> > So you need to feed it with extra info on the optimized out stmts because > as-is it will not remove __builtin_unreachable (). That means you're
My plan was to add entry point to tree-ssa-dce that will take an set of stmts declared dead by external force and will do the usual mark stage bypassing mark_stmt_if_necessary if the stmt is in the set of deads. > doing the find_obviously_necessary_stmts manually, skipping the > conditional and all stmts it controls to the __builtin_unreachable () path? > > I also think you want something cheaper than non-cd-dce mark, you also don't > want to bother with stores/loads? You are probably right. cd-dce marking became bit of a monster and I do not want to care about memory. One can add extra flag to avoid processing of memory, but the code I would re-use is quite small. I can do my own mark&sweep just considering phis, pre-identified conditionals and basic gimple_assigns with no side effects as possibly unnecesary stmts. I can completely ignore debug stmts. So it should be one pass through the statments to populate the worklist & simple walk of the ssa graph to propagae it. > > Also when you only do this conditional how do you plan to use the result? Well, the analysis is a loop that walks all basic blocks and then all stmts. I can keep track if computation of live stmts was done and in that case query the flag assume it is true otherwise. Honza