From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21542 invoked by alias); 26 Aug 2008 21:17:29 -0000 Received: (qmail 21268 invoked by uid 48); 26 Aug 2008 21:16:06 -0000 Date: Tue, 26 Aug 2008 21:17:00 -0000 Message-ID: <20080826211606.21267.qmail@sourceware.org> X-Bugzilla-Reason: CC References: Subject: [Bug tree-optimization/37242] missed FRE opportunity because of signedness of addition In-Reply-To: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "pinskia 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-08/txt/msg02002.txt.bz2 ------- Comment #3 from pinskia at gcc dot gnu dot org 2008-08-26 21:16 ------- >This could be due to array indexing lowered to POINTER_PLUS_EXPR. Array indexing is never lowered using POINTER_PLUS_EXPR, only for pointers it is. Though it looks like we are doing the math in unsigned in one case but signed in another but we don't consider them the same for PRE. Simple testcase: int f(int a) { unsigned b = a; b++; a++; return a + b; } We should just get return a*2 + 2; (which we do at the RTL level) but we get: b = (unsigned int) a; return (int) ((b + 1) + (unsigned int) (a + 1)); -- pinskia at gcc dot gnu dot org changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Ever Confirmed|0 |1 Last reconfirmed|0000-00-00 00:00:00 |2008-08-26 21:16:06 date| | Summary|missed FRE opportunity |missed FRE opportunity | |because of signedness of | |addition http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37242