From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21058 invoked by alias); 21 Aug 2006 23:24:46 -0000 Received: (qmail 21047 invoked by uid 48); 21 Aug 2006 23:24:38 -0000 Date: Mon, 21 Aug 2006 23:24:00 -0000 Subject: [Bug tree-optimization/28794] New: missed optimization with non COND_EXPR and vrp and comparisions X-Bugzilla-Reason: CC Message-ID: 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-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2006-08/txt/msg01767.txt.bz2 List-Id: int f(int x, int y) { int t; for (t = 0; t < 50; t++) g(t>0); } void f1(int x, int y) { int t; for (t = 0; t < 50; t++) g(t!=0); } -------------- The above two functions should produce the same code with f1 being better than f. If we change it to: void f2(int x, int y) { int t; for (t = 0; t < 50; t++) { int tt; if (t>0) tt = 1; else tt = 0; g(tt); } } ----- We get f1 so we are only folding comparisions in a COND_EXPR which is wrong, we should also be doing them in MODIFY_EXPRs too. -- Summary: missed optimization with non COND_EXPR and vrp and comparisions Product: gcc Version: 4.2.0 Status: UNCONFIRMED Keywords: missed-optimization Severity: enhancement Priority: P3 Component: tree-optimization AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: pinskia at gcc dot gnu dot org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28794