public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/37837] New: missed PRE
@ 2008-10-15 9:58 rguenth at gcc dot gnu dot org
2008-11-01 14:15 ` [Bug tree-optimization/37837] " rguenth at gcc dot gnu dot org
0 siblings, 1 reply; 2+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2008-10-15 9:58 UTC (permalink / raw)
To: gcc-bugs
Testcase where only one constant, not two alternative constants, are on the
entry of the threaded bb.
extern int printf (const char *, ...);
void
__attribute__((noinline))
test (double cn, int *neig)
{
double tt, al[3];
*neig = 3;
if (__builtin_fabs(cn) > 1.)
cn = -1.;
tt = __builtin_atan2 (__builtin_sqrt (1. - __builtin_pow (cn, 2.)), cn)
* 3.333333333333333e-1;
al[0] = __builtin_cos (tt);
al[1] = __builtin_cos (2.0943951023931944 + tt);
al[2] = __builtin_cos (4.1887902047863879 + tt);
if ((__builtin_fabs ( al[0] - al[1]) < 1.e-5)
|| (__builtin_fabs (al[0] - al[2]) < 1.e-5)
|| (__builtin_fabs (al[1] - al[2]) < 1.e-5))
*neig = 2;
}
int
main ()
{
int neig;
test (-1.0, &neig);
printf ("neig = %d\n", neig);
if (neig != 2)
__builtin_abort ();
test (1.0, &neig);
printf ("neig = %d\n", neig);
if (neig != 2)
__builtin_abort ();
test (-2.0, &neig);
printf ("neig = %d\n", neig);
if (neig != 2)
__builtin_abort ();
return 0;
}
cn == -1 is available.
--
Summary: missed PRE
Product: gcc
Version: 4.4.0
Status: UNCONFIRMED
Keywords: missed-optimization
Severity: enhancement
Priority: P3
Component: tree-optimization
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: rguenth at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37837
^ permalink raw reply [flat|nested] 2+ messages in thread
* [Bug tree-optimization/37837] missed PRE
2008-10-15 9:58 [Bug tree-optimization/37837] New: missed PRE rguenth at gcc dot gnu dot org
@ 2008-11-01 14:15 ` rguenth at gcc dot gnu dot org
0 siblings, 0 replies; 2+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2008-11-01 14:15 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from rguenth at gcc dot gnu dot org 2008-11-01 14:14 -------
Seems to work now. DOM1 threads the jump, if disabled PRE correctly detects
the partial redundant calls and optimizes them. But we miss a jump threading
pass after PRE which makes us end up with
<bb 2>:
*neig = 3;
if (ABS_EXPR <cn> > 1.0e+0)
goto <bb 9>;
else
goto <bb 3>;
<bb 9>:
prephitmp.33 = 1.5e+0;
prephitmp.31 = 4.99999999999997002397833512077340856194496154785e-1;
prephitmp.29 = -1.0e+0;
prephitmp.17 = 5.00000000000000111022302462515654042363166809082e-1;
goto <bb 4>;
...
<bb 4>:
if (prephitmp.33 < 1.00000000000000008180305391403130954586231382564e-5)
goto <bb 7>;
else
goto <bb 5>;
<bb 5>:
if (ABS_EXPR <prephitmp.17 - prephitmp.31> <
1.00000000000000008180305391403130954586231382564e-5)
goto <bb 7>;
else
goto <bb 6>;
<bb 6>:
if (ABS_EXPR <prephitmp.29 - prephitmp.31> <
1.00000000000000008180305391403130954586231382564e-5)
goto <bb 7>;
else
goto <bb 8>;
<bb 7>:
*neig = 2;
note that VRP doesn't track floating-point ranges and thus does not thread
jumps here.
--
rguenth at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |FIXED
Target Milestone|--- |4.4.0
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37837
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2008-11-01 14:15 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-10-15 9:58 [Bug tree-optimization/37837] New: missed PRE rguenth at gcc dot gnu dot org
2008-11-01 14:15 ` [Bug tree-optimization/37837] " rguenth at gcc dot gnu dot 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).