From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18726 invoked by alias); 5 Mar 2008 07:45:37 -0000 Received: (qmail 18395 invoked by uid 48); 5 Mar 2008 07:44:54 -0000 Date: Wed, 05 Mar 2008 07:45:00 -0000 Subject: [Bug tree-optimization/35467] New: Missed optimization in dependency analysis for arrays allocated by new() X-Bugzilla-Reason: CC Message-ID: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "victork at gcc dot gnu dot org" Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2008-03/txt/msg00287.txt.bz2 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 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 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; : 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