On 3/5/19 7:44 AM, Richard Biener wrote: > So fixing it properly with also re-optimize_stmt those stmts so we'd CSE > the MAX_EXPR introduced by folding makes it somewhat ugly. > > Bootstrapped on x86_64-unknown-linux-gnu, testing in progress. > > Any ideas how to make it less so? I can split out making optimize_stmt > take a gsi * btw, in case that's a more obvious change and it makes the > patch a little smaller. > > Richard. > > 2019-03-05 Richard Biener <rguent...@suse.de> > > PR tree-optimization/89595 > * tree-ssa-dom.c (dom_opt_dom_walker::optimize_stmt): Take > stmt iterator as reference, take boolean output parameter to > indicate whether the stmt was removed and thus the iterator > already advanced. > (dom_opt_dom_walker::before_dom_children): Re-iterate over > stmts created by folding. > > * gcc.dg/torture/pr89595.c: New testcase. >
Well, all the real logic changs are in the before_dom_children method. The bits in optimize_stmt are trivial enough to effectively ignore. I don't see a better way to discover and process statements that are created in the bowels of fold_stmt. Jeff