From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14591 invoked by alias); 1 Dec 2002 23:26:00 -0000 Mailing-List: contact gcc-prs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-prs-owner@gcc.gnu.org Received: (qmail 14572 invoked by uid 71); 1 Dec 2002 23:26:00 -0000 Resent-Date: 1 Dec 2002 23:26:00 -0000 Resent-Message-ID: <20021201232600.14571.qmail@sources.redhat.com> Resent-From: gcc-gnats@gcc.gnu.org (GNATS Filer) Resent-Cc: gcc-prs@gcc.gnu.org, gcc-bugs@gcc.gnu.org Resent-Reply-To: gcc-gnats@gcc.gnu.org, lomov1@yahoo.com Received: (qmail 11967 invoked by uid 61); 1 Dec 2002 23:16:35 -0000 Message-Id: <20021201231635.11966.qmail@sources.redhat.com> Date: Sun, 01 Dec 2002 15:26:00 -0000 From: lomov1@yahoo.com Reply-To: lomov1@yahoo.com To: gcc-gnats@gcc.gnu.org X-Send-Pr-Version: gnatsweb-2.9.3 (1.1.1.1.2.31) Subject: optimization/8776: loop invariants are not removed (most likely) X-SW-Source: 2002-12/txt/msg00039.txt.bz2 List-Id: >Number: 8776 >Category: optimization >Synopsis: loop invariants are not removed (most likely) >Confidential: no >Severity: serious >Priority: medium >Responsible: unassigned >State: open >Class: pessimizes-code >Submitter-Id: net >Arrival-Date: Sun Dec 01 15:26:00 PST 2002 >Closed-Date: >Last-Modified: >Originator: lomov1@yahoo.com >Release: gcc version 3.2 (Mandrake Linux 9.0 3.2-1mdk); also with gcc-3.1 >Organization: >Environment: Linux 2.4.19-16mdk i686 GNU/Linux Mandrake 9.0 AMD Athlon(tm) Processor stepping 2 cpu MHz 908.111 >Description: There is a following program: ------ struct str{ int f[3]; }; int main (int argc, char *argv[]) { double d[1]; double* pd=d; str s; int* pf=&s.f[0]; s.f[0]=s.f[1]=s.f[2]=0; for (int i=0;i<1000000000;++i) { #ifdef SLOW1 pd[s.f[0]+s.f[1]*s.f[2]]=1; #elif defined(SLOW2) d[pf[0]+pf[1]*pf[2]]=1; #else pd[pf[0]+pf[1]*pf[2]]=1; #endif } } ------ after compilation with gcc-3.2 -O9 on Linux Mandrake 9.0 Athlon 900MHz, time ./a.out of the SLOW[12] version gives >10s time ./a.out of the "!defined(SLOW[12])" version gives 3.50s Logically this is the same thing... >How-To-Repeat: gcc -O9 test.cpp ; time ./a.out gcc -O9 -DSLOW1 test.cpp ; time ./a.out gcc -O9 -DSLOW2 test.cpp ; time ./a.out >Fix: gcc-2.96 doesn't have this problem. Sorry, but I don't have access to other official (besides 3.1 and 3.2) releases >Release-Note: >Audit-Trail: >Unformatted: ----gnatsweb-attachment---- Content-Type: application/octet-stream; name="test.cpp" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="test.cpp" aW50IG1haW4gKGludCBhcmdjLCBjaGFyICphcmd2W10pCnsKICAgZG91YmxlIGRbMV07CiAgIGRv dWJsZSogcGQ9ZDsKICAgc3RyIHM7CiAgIGludCogcGY9JnMuZlswXTsKICAgcy5mWzBdPXMuZlsx XT1zLmZbMl09MDsKICAgZm9yIChpbnQgaT0wO2k8MTAwMDAwMDAwMDsrK2kpIHsKI2lmZGVmIFNM T1cxCiAgICAgIHBkW3MuZlswXStzLmZbMV0qcy5mWzJdXT0xOwojZWxpZiBkZWZpbmVkKFNMT1cy KQogICAgICBkW3BmWzBdK3BmWzFdKnBmWzJdXT0xOwojZWxzZQogICAgICBwZFtwZlswXStwZlsx XSpwZlsyXV09MTsKI2VuZGlmCiAgIH0KfQoK