From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7870 invoked by alias); 1 Nov 2008 17:12:56 -0000 Received: (qmail 839 invoked by uid 48); 1 Nov 2008 17:11:29 -0000 Date: Sat, 01 Nov 2008 17:12:00 -0000 Message-ID: <20081101171129.835.qmail@sourceware.org> X-Bugzilla-Reason: CC References: Subject: [Bug tree-optimization/37542] [4.4 Regression] PRE doesn't simplify during phi-translation In-Reply-To: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "rguenth 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-11/txt/msg00066.txt.bz2 ------- Comment #4 from rguenth at gcc dot gnu dot org 2008-11-01 17:11 ------- We need to be careful with simplifying to SSA_NAMEs as the following example shows: int foo (int i, int b) { int mask; int result; if (b) mask = -1; else mask = 0; result = i + 1; result = result & mask; return result; } we have a phi-translation for result & mask that is 0 or result dependent on the path through the CFG. But we cannot insert this as a PHI as one argument (result with value i + 1) is not available there. The PRE of 4.3 inserts i + 1, re-generating the expression recursively and exposing a code hoisting opportunity: : if (b_2(D) != 0) goto ; else goto ; : pretmp.6_10 = i_5(D) + 1; pretmp.6_11 = pretmp.6_10; goto ; : pretmp.6_13 = i_5(D) + 1; : # prephitmp.7_14 = PHI # prephitmp.7_12 = PHI # mask_1 = PHI <-1(5), 0(3)> result_6 = prephitmp.7_14; result_7 = prephitmp.7_12; return result_7; I don't think we want to do this now (without code hoisting implemented), but for cases where result_6 is available we surely want it. I'm trying to find a way to detect whether it is safe to phi-translate to result_6. -- rguenth at gcc dot gnu dot org changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |dberlin at gcc dot gnu dot | |org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37542