From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 29806 invoked by alias); 12 Mar 2014 10:27:29 -0000 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 Received: (qmail 29760 invoked by uid 48); 12 Mar 2014 10:27:25 -0000 From: "amker.cheng at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug regression/60363] [4.9 Regression]: logical_op_short_circuit, gcc.dg/tree-ssa/ssa-dom-thread-4.c scan-tree-dump-times dom1 "Threaded" 4 Date: Wed, 12 Mar 2014 10:27:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: regression X-Bugzilla-Version: 4.7.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: amker.cheng at gmail dot com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 4.9.0 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2014-03/txt/msg00957.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60363 --- Comment #7 from bin.cheng --- The problem has nothing to do with VRP, and might be a missed opportunity of jump threading. The dump after VRP but before jump threading at the end of VRP is like: ... : goto ; ... : # kill_elt_3 = PHI if (b_elt_11(D) != 0B) goto ; else goto ; : if (kill_elt_3 != 0B) goto ; else goto ; : goto ; ... : # changed_19 = PHI # kill_elt_18 = PHI : # changed_1 = PHI # kill_elt_4 = PHI if (a_elt_9(D) != 0B) goto ; else goto ; There is jump threading path like: Registering jump thread: (21, 7) incoming edge; (7, 8) joiner; (8, 22) normal; After jump threading, the dump is like: : # kill_elt_2 = PHI if (kill_elt_2 != 0B) goto ; else goto ; : goto ; ... : # changed_19 = PHI # kill_elt_18 = PHI : # changed_1 = PHI # kill_elt_4 = PHI if (a_elt_9(D) != 0B) goto ; else goto ; ... : goto ; : # kill_elt_41 = PHI <0B(21)> if (b_elt_11(D) != 0B) goto ; else goto ; During jump threading process, GCC updates phi node in destination basic block like "kill_elt_18 = PHI <". Because bb27 is duplicated from bb7, the phi argument "kill_elt_3(27)" is copied directly from "kill_elt_3(7)". Although "kill_elt_3 == 0" holds when coming from edge , gcc doesn't know this fact. At last, cfgcleanup tries to remove forwarder block bb26, but it can't make it because the phi arguments from edge and edge doesn't match. I am thinking maybe jump threading can back trace the threading path and try to add phi argument for edge with the value(0) of kill_elt_3 (i.e., "0(27)"). The value is available along the jump threading path.