On Sat, Oct 09, 2010 at 09:22:42PM +0200, Manuel L?pez-Ib??ez wrote: > My intention by answering Gary is to point out that if he is thinking > about working on this problem, he should consider building a cheap > FE-specific CFG, rather than try to share the current infrastructure > between FE and middle-end. I would like to see this implemented, so
I don't think that's a good idea. Much better would be just to not emit diagnostics, which shouldn't be emitted for dead code, right away, but instead of that queue it into the IL (in a form of something like __builtin_diagnostics, or something similar). Then after cfg cleanup + DCE has been run (or at expansion time?) we could issue diagnostics for the __builtin_diagnostics left in the IL afterwards. For -O0 if no DCE happens at all we could have some cheap pass that would just nuke obviously unreachable __builtin_diagnostics and don't modify the IL otherwise (of course gated on whether there are any in the IL). Jakub