[Bug tree-optimization/38691] New: missed optimization with const pointers
tkoenig at gcc dot gnu dot org
gcc-bugzilla@gcc.gnu.org
Fri Jan 2 09:50:00 GMT 2009
This is one possible C equivalent of PR 23169, a Fortran PR.
$ cat foo.c
void bar(const int *, const int *);
int foo(const int *b, const int *c)
{
int d,e;
d = *b;
e = *c;
bar(b, c);
return (d- *b) + (e - *c);
}
$ gcc -O3 -fdump-tree-optimized -S foo.c
$ cat foo.c.123t.optimized
;; Function foo (foo)
Analyzing Edge Insertions.
foo (const int * b, const int * c)
{
int e;
int d;
<bb 2>:
d = *b;
e = *c;
bar (b, c);
return ((e - *b) + d) - *c;
}
Without the call to bar, the function is optimized
to "return 0". This should be possible even with the
call to bar, because all pointers in sight are marked const.
--
Summary: missed optimization with const pointers
Product: gcc
Version: 4.4.0
Status: UNCONFIRMED
Keywords: alias
Severity: enhancement
Priority: P3
Component: tree-optimization
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: tkoenig at gcc dot gnu dot org
OtherBugsDependingO 23169
nThis:
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38691
More information about the Gcc-bugs
mailing list