From owner-freebsd-current@FreeBSD.ORG Wed Jul 4 12:12:11 2007 Return-Path: X-Original-To: current@freebsd.org Delivered-To: freebsd-current@FreeBSD.ORG Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 6176F16A41F; Wed, 4 Jul 2007 12:12:11 +0000 (UTC) (envelope-from ed@hoeg.nl) Received: from palm.hoeg.nl (mx0.hoeg.nl [83.98.131.211]) by mx1.freebsd.org (Postfix) with ESMTP id 994FA13C44C; Wed, 4 Jul 2007 12:12:10 +0000 (UTC) (envelope-from ed@hoeg.nl) Received: by palm.hoeg.nl (Postfix, from userid 1000) id D10501CC28; Wed, 4 Jul 2007 14:12:08 +0200 (CEST) Date: Wed, 4 Jul 2007 14:12:08 +0200 From: Ed Schouten To: Andrey Chernov , Alexander Kabaev , current@freebsd.org, kan@freebsd.org Message-ID: <20070704121208.GC37187@hoeg.nl> References: <20070625130913.GA50273@nagual.pp.ru> <20070625133951.GA51324@nagual.pp.ru> <8e5ef5f70706250659v48f64410wb5399985a571087e@mail.gmail.com> <20070625145627.GA53685@nagual.pp.ru> <20070625151508.GO27942@hoeg.nl> <20070625152559.GA54055@nagual.pp.ru> <20070625153840.GP27942@hoeg.nl> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="s9fJI615cBHmzTOP" Content-Disposition: inline In-Reply-To: <20070625153840.GP27942@hoeg.nl> User-Agent: Mutt/1.5.16 (2007-06-09) Cc: Subject: [Patch] Silent gcc 4.2.0 loop optimization bug with -O2 X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Jul 2007 12:12:11 -0000 --s9fJI615cBHmzTOP Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hello, This morning I received the following message from GCC's Bugzilla: ----- Forwarded message from rguenth at gcc dot gnu dot org ----- > Date: 4 Jul 2007 10:16:52 -0000 > From: rguenth at gcc dot gnu dot org > To: ed@fxq.nl > Reply-To: gcc-bugzilla@gcc.gnu.org > Subject: [Bug tree-optimization/32500] [4.2 Regression] Loop optimization > limits range to size of array used inside loop >=20 > [snip] >=20 > scev_probably_wraps_p() returns false for the above chrec because for > the loop in question estimated_nb_iterations is 4(!) which is derived > from infer_loop_bounds_from_undefined. On the trunk this is fixed > by rewriting number of iterations analysis. On the 4.2 branch we > can fix this conservatively by >=20 > Index: tree-ssa-loop-niter.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > --- tree-ssa-loop-niter.c (revision 126260) > +++ tree-ssa-loop-niter.c (working copy) > @@ -1747,6 +1747,12 @@ infer_loop_bounds_from_undefined (struct > { > bb =3D bbs[i]; >=20 > + /* If BB is not executed in each iteration of the loop, we cannot > + use the operations in it to infer reliable upper bound on the > + # of iterations of the loop. */ > + if (!dominated_by_p (CDI_DOMINATORS, loop->latch, bb)) > + continue; > + > for (bsi =3D bsi_start (bb); !bsi_end_p (bsi); bsi_next (&bsi)) > { > tree stmt =3D bsi_stmt (bsi); >=20 > I'm going to test this. >=20 ----- End forwarded message ----- I just tested the patch on my desktop and it seems to work. The test code now compiles like it should. Hopefully it will be part of 4.2.1. Yours, --=20 Ed Schouten WWW: http://g-rave.nl/ --s9fJI615cBHmzTOP Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.7 (FreeBSD) iD8DBQFGi46Y52SDGA2eCwURAkO8AJ9htSQ7ZhuaJ09/WD/wKzofY78+uACfc+jV oaACxIeL38uz9qMliIdni8M= =OFeT -----END PGP SIGNATURE----- --s9fJI615cBHmzTOP--