public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/30104] New: missed code motion optimization (invariant control structures)
@ 2006-12-07 6:12 dann at godzilla dot ics dot uci dot edu
2006-12-07 14:17 ` [Bug tree-optimization/30104] " rguenth at gcc dot gnu dot org
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: dann at godzilla dot ics dot uci dot edu @ 2006-12-07 6:12 UTC (permalink / raw)
To: gcc-bugs
The following 2 functions should be compiled to the same assembly.
This is one of Briggs' compiler benchmarks.
void motion_test10(int *data)
{
int j;
int p = data[1];
int i = data[0];
do {
if (p)
j = 1;
else
j = 2;
i = i + j;
data[data[2]] = 2;
} while (i < data[3]);
}
void motion_result10(int *data)
{
int j;
int p = data[1];
int i = data[0];
if (p)
j = 1;
else
j = 2;
do {
i = i + j;
data[data[2]] = 2;
} while (i < data[3]);
}
--
Summary: missed code motion optimization (invariant control
structures)
Product: gcc
Version: 4.3.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: tree-optimization
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: dann at godzilla dot ics dot uci dot edu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30104
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug tree-optimization/30104] missed code motion optimization (invariant control structures)
2006-12-07 6:12 [Bug tree-optimization/30104] New: missed code motion optimization (invariant control structures) dann at godzilla dot ics dot uci dot edu
@ 2006-12-07 14:17 ` rguenth at gcc dot gnu dot org
2006-12-07 16:46 ` pinskia at gcc dot gnu dot org
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2006-12-07 14:17 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from rguenth at gcc dot gnu dot org 2006-12-07 14:17 -------
Confirmed.
--
rguenth at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |rguenth at gcc dot gnu dot
| |org
Severity|normal |enhancement
Status|UNCONFIRMED |NEW
Ever Confirmed|0 |1
Keywords| |missed-optimization
Last reconfirmed|0000-00-00 00:00:00 |2006-12-07 14:17:34
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30104
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug tree-optimization/30104] missed code motion optimization (invariant control structures)
2006-12-07 6:12 [Bug tree-optimization/30104] New: missed code motion optimization (invariant control structures) dann at godzilla dot ics dot uci dot edu
2006-12-07 14:17 ` [Bug tree-optimization/30104] " rguenth at gcc dot gnu dot org
@ 2006-12-07 16:46 ` pinskia at gcc dot gnu dot org
2006-12-07 16:49 ` rguenth at gcc dot gnu dot org
2006-12-07 18:24 ` dann at godzilla dot ics dot uci dot edu
3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-12-07 16:46 UTC (permalink / raw)
To: gcc-bugs
------- Comment #2 from pinskia at gcc dot gnu dot org 2006-12-07 16:46 -------
isn't this the same as loop unswitching?
PS This was done from a PS3!
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30104
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug tree-optimization/30104] missed code motion optimization (invariant control structures)
2006-12-07 6:12 [Bug tree-optimization/30104] New: missed code motion optimization (invariant control structures) dann at godzilla dot ics dot uci dot edu
2006-12-07 14:17 ` [Bug tree-optimization/30104] " rguenth at gcc dot gnu dot org
2006-12-07 16:46 ` pinskia at gcc dot gnu dot org
@ 2006-12-07 16:49 ` rguenth at gcc dot gnu dot org
2006-12-07 18:24 ` dann at godzilla dot ics dot uci dot edu
3 siblings, 0 replies; 5+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2006-12-07 16:49 UTC (permalink / raw)
To: gcc-bugs
------- Comment #3 from rguenth at gcc dot gnu dot org 2006-12-07 16:49 -------
unswitching would duplicate the whole loop here, so not exactly I think. But
if-conversion to
j = COND_EXPR <p, 1, 2>
or
j = 2 - (int)p;
would make j loop invariant.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30104
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug tree-optimization/30104] missed code motion optimization (invariant control structures)
2006-12-07 6:12 [Bug tree-optimization/30104] New: missed code motion optimization (invariant control structures) dann at godzilla dot ics dot uci dot edu
` (2 preceding siblings ...)
2006-12-07 16:49 ` rguenth at gcc dot gnu dot org
@ 2006-12-07 18:24 ` dann at godzilla dot ics dot uci dot edu
3 siblings, 0 replies; 5+ messages in thread
From: dann at godzilla dot ics dot uci dot edu @ 2006-12-07 18:24 UTC (permalink / raw)
To: gcc-bugs
------- Comment #4 from dann at godzilla dot ics dot uci dot edu 2006-12-07 18:24 -------
(In reply to comment #3)
> unswitching would duplicate the whole loop here, so not exactly I think. But
> if-conversion to
>
> j = COND_EXPR <p, 1, 2>
>
> or
>
> j = 2 - (int)p;
>
> would make j loop invariant.
if-conversion would solve this particular testcase, but the more general case
of moving invariant control structures out of the loop is probably more
interesting.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30104
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2006-12-07 18:24 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-12-07 6:12 [Bug tree-optimization/30104] New: missed code motion optimization (invariant control structures) dann at godzilla dot ics dot uci dot edu
2006-12-07 14:17 ` [Bug tree-optimization/30104] " rguenth at gcc dot gnu dot org
2006-12-07 16:46 ` pinskia at gcc dot gnu dot org
2006-12-07 16:49 ` rguenth at gcc dot gnu dot org
2006-12-07 18:24 ` dann at godzilla dot ics dot uci dot edu
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).