public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/20514] New: hoisting of label out of jumptable would take place at cse, should happen at trees
@ 2005-03-17 8:21 aoliva at gcc dot gnu dot org
2005-03-17 17:23 ` [Bug tree-optimization/20514] " pinskia at gcc dot gnu dot org
` (3 more replies)
0 siblings, 4 replies; 10+ messages in thread
From: aoliva at gcc dot gnu dot org @ 2005-03-17 8:21 UTC (permalink / raw)
To: gcc-bugs
The following testcase from bug 18628 exposes a case in which cse would have
folded a load from a jump table into a label. Jeff suspects this should have
happened earlier, in the tree level, so he asked me to file this bug. Here's
the testcase:
int i;
int main()
{
for (;;)
{
switch (i)
{
case 0:
case 1:
return 1;
case 2:
case 3:
return 0;
case 5:
--i;
}
}
}
--
Summary: hoisting of label out of jumptable would take place at
cse, should happen at trees
Product: gcc
Version: 4.0.0
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: tree-optimization
AssignedTo: law at gcc dot gnu dot org
ReportedBy: aoliva at gcc dot gnu dot org
CC: gcc-bugs at gcc dot gnu dot org
OtherBugsDependingO 19721
nThis:
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20514
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug tree-optimization/20514] hoisting of label out of jumptable would take place at cse, should happen at trees
2005-03-17 8:21 [Bug tree-optimization/20514] New: hoisting of label out of jumptable would take place at cse, should happen at trees aoliva at gcc dot gnu dot org
@ 2005-03-17 17:23 ` pinskia at gcc dot gnu dot org
2005-04-13 18:30 ` pinskia at gcc dot gnu dot org
` (2 subsequent siblings)
3 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-03-17 17:23 UTC (permalink / raw)
To: gcc-bugs
------- 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|0000-00-00 00:00:00 |2005-03-17 17:23:27
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20514
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug tree-optimization/20514] hoisting of label out of jumptable would take place at cse, should happen at trees
2005-03-17 8:21 [Bug tree-optimization/20514] New: hoisting of label out of jumptable would take place at cse, should happen at trees aoliva at gcc dot gnu dot org
2005-03-17 17:23 ` [Bug tree-optimization/20514] " pinskia at gcc dot gnu dot org
@ 2005-04-13 18:30 ` pinskia at gcc dot gnu dot org
2005-05-06 8:50 ` steven at gcc dot gnu dot org
2005-05-06 13:40 ` pinskia at gcc dot gnu dot org
3 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-04-13 18:30 UTC (permalink / raw)
To: gcc-bugs
------- 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
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug tree-optimization/20514] hoisting of label out of jumptable would take place at cse, should happen at trees
2005-03-17 8:21 [Bug tree-optimization/20514] New: hoisting of label out of jumptable would take place at cse, should happen at trees aoliva at gcc dot gnu dot org
2005-03-17 17:23 ` [Bug tree-optimization/20514] " pinskia at gcc dot gnu dot org
2005-04-13 18:30 ` pinskia at gcc dot gnu dot org
@ 2005-05-06 8:50 ` steven at gcc dot gnu dot org
2005-05-06 13:40 ` pinskia at gcc dot gnu dot org
3 siblings, 0 replies; 10+ messages in thread
From: steven at gcc dot gnu dot org @ 2005-05-06 8:50 UTC (permalink / raw)
To: gcc-bugs
------- 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
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug tree-optimization/20514] hoisting of label out of jumptable would take place at cse, should happen at trees
2005-03-17 8:21 [Bug tree-optimization/20514] New: hoisting of label out of jumptable would take place at cse, should happen at trees aoliva at gcc dot gnu dot org
` (2 preceding siblings ...)
2005-05-06 8:50 ` steven at gcc dot gnu dot org
@ 2005-05-06 13:40 ` pinskia at gcc dot gnu dot org
3 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-05-06 13:40 UTC (permalink / raw)
To: gcc-bugs
------- 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
^ permalink raw reply [flat|nested] 10+ messages in thread
[parent not found: <bug-20514-334@http.gcc.gnu.org/bugzilla/>]
* [Bug tree-optimization/20514] hoisting of label out of jumptable would take place at cse, should happen at trees
[not found] <bug-20514-334@http.gcc.gnu.org/bugzilla/>
@ 2006-09-17 8:00 ` pinskia at gcc dot gnu dot org
2007-12-14 15:01 ` aldot at gcc dot gnu dot org
1 sibling, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-09-17 8:00 UTC (permalink / raw)
To: gcc-bugs
------- 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
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug tree-optimization/20514] hoisting of label out of jumptable would take place at cse, should happen at trees
[not found] <bug-20514-334@http.gcc.gnu.org/bugzilla/>
2006-09-17 8:00 ` pinskia at gcc dot gnu dot org
@ 2007-12-14 15:01 ` aldot at gcc dot gnu dot org
1 sibling, 0 replies; 10+ messages in thread
From: aldot at gcc dot gnu dot org @ 2007-12-14 15:01 UTC (permalink / raw)
To: gcc-bugs
------- 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
^ permalink raw reply [flat|nested] 10+ messages in thread
[parent not found: <bug-20514-4@http.gcc.gnu.org/bugzilla/>]
end of thread, other threads:[~2023-08-05 3:09 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-03-17 8:21 [Bug tree-optimization/20514] New: hoisting of label out of jumptable would take place at cse, should happen at trees aoliva at gcc dot gnu dot org
2005-03-17 17:23 ` [Bug tree-optimization/20514] " pinskia at gcc dot gnu dot org
2005-04-13 18:30 ` pinskia at gcc dot gnu dot org
2005-05-06 8:50 ` steven at gcc dot gnu dot org
2005-05-06 13:40 ` pinskia at gcc dot gnu dot org
[not found] <bug-20514-334@http.gcc.gnu.org/bugzilla/>
2006-09-17 8:00 ` pinskia at gcc dot gnu dot org
2007-12-14 15:01 ` aldot at gcc dot gnu dot org
[not found] <bug-20514-4@http.gcc.gnu.org/bugzilla/>
2021-05-04 12:31 ` rguenth at gcc dot gnu.org
2021-07-24 5:17 ` pinskia at gcc dot gnu.org
2023-08-05 3:09 ` pinskia at gcc dot gnu.org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).