public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/35467] New: Missed optimization in dependency analysis for arrays allocated by new()
@ 2008-03-05 7:45 victork at gcc dot gnu dot org
2008-03-05 7:48 ` [Bug tree-optimization/35467] " pinskia at gcc dot gnu dot org
0 siblings, 1 reply; 2+ messages in thread
From: victork at gcc dot gnu dot org @ 2008-03-05 7:45 UTC (permalink / raw)
To: gcc-bugs
The code below demonstrates a missed optimization opportunity that
can have an impact on code.
If arrays are allocated by new(), the static alias analysis is unable to
prove independency:
#include <stdlib.h>
int
foo (void)
{
int *a = new int [1000];
int *b = new int [1000];
int x;
a[10] = 5;
b[10] = 6;
x = a[10];
return x;
}
=cut
While if the arrays are allocated by malloc(), the independency has been
proved:
#include <stdlib.h>
int
foo (void)
{
int *a = (int*) malloc (sizeof(int) * 1000);
int *b = (int*) malloc (sizeof(int) * 1000);
int x;
a[10] = 5;
b[10] = 6;
x = a[10];
free (a);
free (b);
return x;
}
=cut
;; Function int foo() (_Z3foov)
Analyzing Edge Insertions.
int foo() ()
{
int * b;
int * a;
void * D.2486;
void * D.2485;
<bb 2>:
D.2485 = malloc (4000);
a = (int *) D.2485;
D.2486 = malloc (4000);
b = (int *) D.2486;
*(a + 40) = 5;
*(b + 40) = 6;
free (a);
free (b);
return 5;
}
The ability to prove dependency in this kind of c++ source code can enable
vectorization for many loops.
--
Summary: Missed optimization in dependency analysis for arrays
allocated by new()
Product: gcc
Version: 4.4.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: tree-optimization
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: victork at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35467
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2008-03-05 7:48 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-03-05 7:45 [Bug tree-optimization/35467] New: Missed optimization in dependency analysis for arrays allocated by new() victork at gcc dot gnu dot org
2008-03-05 7:48 ` [Bug tree-optimization/35467] " pinskia 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).