https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117123

--- Comment #5 from Filip Kastl <pheeck at gcc dot gnu.org> ---
PRE is the pass that should be able to optimize most of the code in the
testcase away.  It doesn't remove the code if sccopy1 has run.  I looked at
gimple dumps before PRE for compiler runs with sccopy1 and without sccopy1.  I
think that the only difference is here

with sccopy

---
 43   <bb 3> [local count: 19861441]:
 44   _36 = a_24(D) & 1;
 45   if (_36 == 0)
 46     goto <bb 4>; [66.00%]
 47   else
 48     goto <bb 5>; [34.00%]
 49
 50   <bb 4> [local count: 13108551]:
 51   if (a_24(D) != 10)
 52     goto <bb 6>; [66.00%]
 53   else
 54     goto <bb 5>; [34.00%]
 55
 56   <bb 5> [local count: 21441448]:
 57   # spud$size_22 = PHI <10(4), a_24(D)(2), a_24(D)(3)>
 58   _5 = a_24(D) == -100;
 59   goto <bb 9>; [100.00%]
---

without sccopy

---
 43   <bb 3> [local count: 21441448]:
 44   # spud$size_55 = PHI <a_31(D)(2), a_31(D)(4), 10(5)>
 45   _7 = a_31(D) == -100;
 46   goto <bb 9>; [100.00%]
 47 
 48   <bb 4> [local count: 19861441]:
 49   _44 = a_31(D) & 1;
 50   if (_44 == 0)
 51     goto <bb 5>; [66.00%]
 52   else
 53     goto <bb 3>; [34.00%]
 54 
 55   <bb 5> [local count: 13108551]:
 56   if (a_31(D) != 10)
 57     goto <bb 6>; [66.00%]
 58   else
 59     goto <bb 3>; [34.00%]
---

If we ignore ssa name version numbers, these snippets are basically the same. 
The only difference is the order of basic blocks.  For some reason, this
difference is important to PRE.  Note that I have only a basic idea about what
PRE does and how it does it.

Reply via email to