[Bug tree-optimization/20514] hoisting of label out of jumptable would take place at cse, should happen at trees
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=20514 --- Comment #9 from Andrew Pinski --- in GCC 13+ we get now (for the testcase in comment #0) at -O3: ``` [local count: 452984831]: # i_lsm.4_2 = PHI if (i_lsm.4_2 == 5) goto ; [25.00%] else goto ; [75.00%] [local count: 452984832]: goto ; [100.00%] ``` This is an infinite no matter which branch is taken ... Coming in we get either `3->4->4->5` or `3->4->5` no matter what we end up in 5 always.
[Bug tree-optimization/20514] hoisting of label out of jumptable would take place at cse, should happen at trees
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=20514 --- Comment #8 from Andrew Pinski --- Note I noticed gimple loop code invariant motion is causing comment #0 to be really bad.
[Bug tree-optimization/20514] hoisting of label out of jumptable would take place at cse, should happen at trees
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=20514 Richard Biener changed: What|Removed |Added Status|NEW |ASSIGNED
[Bug tree-optimization/20514] hoisting of label out of jumptable would take place at cse, should happen at trees
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=20514 --- Comment #7 from Andrew Pinski --- (In reply to Andrew Pinski from comment #2) > Two things, we just don't jump thread. The testcase in comment #2 works correctly on the trunk: [15.0%]: i_lsm.3_8 = i; switch (i_lsm.3_8) [15.0%], case 5: [85.0%]> [85.0%]: i = 4; [15.0%]: return 0; That is no loop.
[Bug tree-optimization/20514] hoisting of label out of jumptable would take place at cse, should happen at trees
--- Comment #6 from aldot at gcc dot gnu dot org 2007-12-14 15:00 --- Still present on current trunk (20071214). This used to work with 3.4.6: .L14: cmpl$5, %eax ja .L14 .ident GCC: (GNU) 3.4.6 (Debian 3.4.6-6) Not quite optimal though since this would be even better: .L14: cmpl $5,%eax ja .L4711 .L4711: jmp .L4711 (or something to that effect). -- aldot at gcc dot gnu dot org changed: What|Removed |Added CC||aldot at gcc dot gnu dot org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20514
[Bug tree-optimization/20514] hoisting of label out of jumptable would take place at cse, should happen at trees
--- Comment #5 from pinskia at gcc dot gnu dot org 2006-09-17 07:59 --- (In reply to comment #2) Two things, we just don't jump thread. The testcase mentioned in comment #2 is fixed but we still don't make an infinite loop for the orginal case: L9:; switch (i_lsm.25) { case 0 ... 1: goto L1; case 2 ... 3: goto L12; case 5: goto L5; default : goto L9; } L5:; i_lsm.25 = 4; goto bb 3 (L9); ... Which is obvious an infinite loop but we still go through the switch every time. -- pinskia at gcc dot gnu dot org changed: What|Removed |Added Last reconfirmed|2006-01-21 03:00:56 |2006-09-17 07:59:49 date|| http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20514
[Bug tree-optimization/20514] hoisting of label out of jumptable would take place at cse, should happen at trees
--- Additional Comments From steven at gcc dot gnu dot org 2005-05-06 08:50 --- Can someone explain what is expected here? I get the following .optimized dump: main () { int lsm_tmp.1; int D.1572; int D.1571; int i.0; L8:; lsm_tmp.1 = i; goto bb 2 (L10); L9:; L10:; switch (lsm_tmp.1) { case 0 ... 1: goto L1; case 2 ... 3: goto L13; case 5: goto L5; default : goto L9; } L1:; i = lsm_tmp.1; D.1571 = 1; goto bb 6 (L7); L5:; lsm_tmp.1 = 4; goto bb 1 (L9); L13:; i = lsm_tmp.1; D.1571 = 0; L7:; return D.1571; } -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20514
[Bug tree-optimization/20514] hoisting of label out of jumptable would take place at cse, should happen at trees
--- Additional Comments From pinskia at gcc dot gnu dot org 2005-05-06 13:39 --- (In reply to comment #3) Can someone explain what is expected here? I get the following .optimized This is what it should look like instead: main () { int lsm_tmp.1; int D.1572; int D.1571; int i.0; L8:; lsm_tmp.1 = i; goto bb 2 (L10); L9:; goto L9; L10:; switch (lsm_tmp.1) { case 0 ... 1: goto L1; case 2 ... 3: goto L13; case 5: goto L5; default : goto L9; } L1:; i = lsm_tmp.1; D.1571 = 1; goto bb 6 (L7); L5:; lsm_tmp.1 = 4; goto bb 1 (L9); L13:; i = lsm_tmp.1; D.1571 = 0; L7:; return D.1571; } So we should get an infinite loop for L9 because there is no way lsm_tmp.1 can change. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20514
[Bug tree-optimization/20514] hoisting of label out of jumptable would take place at cse, should happen at trees
--- Additional Comments From pinskia at gcc dot gnu dot org 2005-04-13 18:30 --- Two things, we just don't jump thread. Another testcase: int i; int main() { for (;;) { switch (i) { case 5: i = 4; break; default: return 0; } } } -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20514
[Bug tree-optimization/20514] hoisting of label out of jumptable would take place at cse, should happen at trees
--- Additional Comments From pinskia at gcc dot gnu dot org 2005-03-17 17:23 --- Confirmed. -- What|Removed |Added Severity|normal |enhancement Status|UNCONFIRMED |NEW Ever Confirmed||1 Keywords||missed-optimization, TREE Last reconfirmed|-00-00 00:00:00 |2005-03-17 17:23:27 date|| http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20514