https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102880
Richard Biener <rguenth at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords|missed-optimization | Status|NEW |ASSIGNED Target Milestone|--- |12.0 Assignee|unassigned at gcc dot gnu.org |rguenth at gcc dot gnu.org --- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> --- The difference after DSE1 is (for main): @@ -235,20 +251,9 @@ <bb 13> : b.11_31 = b; - if (b.11_31 != 0) - goto <bb 15>; [INV] - else - goto <bb 14>; [INV] <bb 14> : - - <bb 15> : - # iftmp.9_36 = PHI <1(13), 0(14)> - d.12_32 = d; - _33 = d.12_32 & iftmp.9_36; - - <bb 17> : - # iftmp.7_35 = PHI <1(10), 0(15)> + # iftmp.7_35 = PHI <1(10), 0(11), 0(13), 0(12)> _34 = (short int) iftmp.7_35; ai = _34; return 0; where this then causes less CDDCE: -marking necessary through iftmp.7_35 stmt iftmp.7_35 = PHI <1(10), 0(15)> -processing: iftmp.7_35 = PHI <1(10), 0(15)> +marking necessary through iftmp.7_35 stmt iftmp.7_35 = PHI <1(10), 0(11), 0(13), 0(12)> +processing: iftmp.7_35 = PHI <1(10), 0(11), 0(13), 0(12)> Marking useful stmt: if (e.8_26 != 0) +Marking useful stmt: if (iftmp.14_83 != 0) + +Marking useful stmt: if (_28 != 0) + +processing: if (_28 != 0) + +marking necessary through _28 stmt _28 = (char) ah.10_27; +processing: _28 = (char) ah.10_27; + +marking necessary through ah.10_27 stmt ah.10_27 = ah; +processing: ah.10_27 = ah; + +processing: if (iftmp.14_83 != 0) + +marking necessary through iftmp.14_83 stmt iftmp.14_83 = a.part.0 (1, _29); +processing: iftmp.14_83 = a.part.0 (1, _29); + +marking necessary through _29 stmt _29 = (int) _28; +processing: _29 = (int) _28; + the key here is I guess that if we'd split the CFG so that PHIs only have _different_ arguments we would be able to reduce the number of control dependences. That seems like a general issue of CD-DCE, in this case exposed by the extra DCE from DSE which in turn triggers block merging from CFG cleanup (we trigger that once we removed a PHI which we did). Now the question is whether there's a good way to alter the control dependence query in a way to make this work without factoring the PHIs first. I suppose querying control dependence of the common dominator of the same-argument PHI edges might work.