From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27007 invoked by alias); 12 Oct 2011 06:36:44 -0000 Received: (qmail 26549 invoked by uid 22791); 12 Oct 2011 06:36:42 -0000 X-SWARE-Spam-Status: No, hits=-0.7 required=5.0 tests=BAYES_00,FROM_12LTRDOM X-Spam-Check-By: sourceware.org Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 12 Oct 2011 06:36:27 +0000 Received: from svr-orw-fem-01.mgc.mentorg.com ([147.34.98.93]) by relay1.mentorg.com with esmtp id 1RDsQU-0000S2-R5 from Tom_deVries@mentor.com ; Tue, 11 Oct 2011 23:36:26 -0700 Received: from SVR-IES-FEM-01.mgc.mentorg.com ([137.202.0.104]) by svr-orw-fem-01.mgc.mentorg.com over TLS secured channel with Microsoft SMTPSVC(6.0.3790.4675); Tue, 11 Oct 2011 23:36:25 -0700 Received: from [127.0.0.1] (137.202.0.76) by SVR-IES-FEM-01.mgc.mentorg.com (137.202.0.104) with Microsoft SMTP Server id 14.1.289.1; Wed, 12 Oct 2011 07:36:23 +0100 Message-ID: <4E953540.3010807@codesourcery.com> Date: Wed, 12 Oct 2011 07:32:00 -0000 From: Tom de Vries User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.23) Gecko/20110922 Thunderbird/3.1.15 MIME-Version: 1.0 To: Richard Guenther CC: "gcc-patches@gcc.gnu.org" Subject: [PR50672, PATCH] Fix ice triggered by -ftree-tail-merge: verify_ssa failed: no immediate_use list Content-Type: multipart/mixed; boundary="------------000506060005010504010700" Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org X-SW-Source: 2011-10/txt/msg00957.txt.bz2 --------------000506060005010504010700 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 7bit Content-length: 2163 Richard, I have a patch for PR50672. When compiling the testcase from the PR with -ftree-tail-merge, the scenario is as follows: We start out tail_merge_optimize with blocks 14 and 20, which are alike, but not equal, since they have different successors: ... # BLOCK 14 freq:690 # PRED: 25 [61.0%] (false,exec) if (wD.2197_57(D) != 0B) goto ; else goto ; # SUCC: 15 [78.4%] (true,exec) 16 [21.6%] (false,exec) # BLOCK 20 freq:2900 # PRED: 29 [100.0%] (fallthru) 31 [100.0%] (fallthru) # .MEMD.2447_209 = PHI <.MEMD.2447_125(29), .MEMD.2447_129(31)> if (wD.2197_57(D) != 0B) goto ; else goto ; # SUCC: 5 [85.0%] (true,exec) 6 [15.0%] (false,exec) ... In the first iteration, we merge block 5 with block 15 and block 6 with block 16. After that, the blocks 14 and 20 are equal. In the second iteration, the blocks 14 and 20 are merged, by redirecting the incoming edges of block 20 to block 14, and removing block 20. Block 20 also contains the definition of .MEMD.2447_209. Removing the definition delinks the vuse of .MEMD.2447_209 in block 5: ... # BLOCK 5 freq:6036 # PRED: 20 [85.0%] (true,exec) # PT = nonlocal escaped D.2306_58 = &thisD.2200_10(D)->D.2156; # .MEMD.2447_132 = VDEF <.MEMD.2447_209> # USE = anything # CLB = anything drawLineD.2135 (D.2306_58, wD.2197_57(D), gcD.2198_59(D)); goto ; # SUCC: 17 [100.0%] (fallthru,exec) ... After the pass, when executing the TODO_update_ssa_only_virtuals, we update the drawLine call in block 5 using rewrite_update_stmt, which calls maybe_replace_use for the vuse operand. However, maybe_replace_use doesn't have an effect since the old vuse and the new vuse happen to be the same (rdef == use), so SET_USE is not called and the vuse remains delinked: ... if (rdef && rdef != use) SET_USE (use_p, rdef); ... The patch fixes this by forcing SET_USE for delinked uses. Bootstrapped and reg-tested on x86_64. OK for trunk? Thanks, - Tom 2011-10-12 Tom de Vries PR tree-optimization/50672 * tree-into-ssa.c (maybe_replace_use): Force SET_USE for delinked uses. --------------000506060005010504010700 Content-Type: text/x-patch; name="pr50672.patch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="pr50672.patch" Content-length: 432 Index: gcc/tree-into-ssa.c =================================================================== --- gcc/tree-into-ssa.c (revision 179592) +++ gcc/tree-into-ssa.c (working copy) @@ -1908,7 +1908,7 @@ maybe_replace_use (use_operand_p use_p) else if (is_old_name (use)) rdef = get_reaching_def (use); - if (rdef && rdef != use) + if (rdef && (rdef != use || (!use_p->next && !use_p->prev))) SET_USE (use_p, rdef); } --------------000506060005010504010700--