From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6623 invoked by alias); 2 Oct 2006 13:56:14 -0000 Received: (qmail 6557 invoked by uid 48); 2 Oct 2006 13:56:04 -0000 Date: Mon, 02 Oct 2006 13:56:00 -0000 Message-ID: <20061002135604.6556.qmail@sourceware.org> X-Bugzilla-Reason: CC References: Subject: [Bug middle-end/27986] [4.0/4.1/4.2 Regression] jump to middle of loop on entry with using old version of an variable In-Reply-To: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "amacleod at redhat dot com" 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-10/txt/msg00134.txt.bz2 List-Id: ------- Comment #4 from amacleod at redhat dot com 2006-10-02 13:56 ------- This is not something out of ssa can resolve on its own. given this sequence: # s_2 = PHI ; # d_1 = PHI ; :; D.1287_8 = MEM[base: d_1]; s_9 = s_2 + D.1287_8; <<<--- s_2 and s_9 have different values d_10 = d_1 + 4B; if (s_9 < g_11) goto ; else goto ; # s_7 = PHI ; <<<--- original value of s_2 used here :; *v_3 = s_7; When s_9 is assigned s_2 + D.1287_8 , they have different values, so when s_2 is used in the PHI assigned to s_7, there is a stretch over which s_9 and s_2 are both live, and contain different values. out of ssa cannot assign them to the same variable. you are going to have a copy in the loop no matter what you do... right now we get: : s = *(v + 4B); :; s.31 = s + MEM[base: d]{*d}; d = d + 4B; if (s.31 < g) goto ; else goto ; :; s = s.31; goto (); :; *v = s; return; the other alternative would be: :; s.31 = s s = s + MEM[base: d]{*d}; d = d + 4B; if (s < g) goto ; else goto ; :; goto (); :; *v = s.31; Is that any better? It looks pretty much the same to me. It might help on a 2 address machine where you need r1 = r1 + exp, but that about it. so Im not sure I understand what you want out of ssa to do with the code here. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27986