From patchwork Mon Jan 11 12:23:46 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom de Vries X-Patchwork-Id: 565792 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id DEA251402F0 for ; Mon, 11 Jan 2016 23:24:17 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=wH0y8HC2; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :subject:to:message-id:date:mime-version:content-type; q=dns; s= default; b=NdeHfvO8y5e9UQJSHaT4wXlWf14wBBj5jHqULF+P2WwP0Kn/sOoj5 NJAzbOqmZt/4sULrRZMwqaES9elpPDbU06n7dUDC5ExhdmYFRkBtJRN+L8hZd6lb 15ek8iEaorHEst2cPhxxurkONHHOEROMBPeWUewGWMVLIMxcy3me2A= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :subject:to:message-id:date:mime-version:content-type; s= default; bh=/8XMuqRPtp8lV5FDs05JOWNF4kc=; b=wH0y8HC2wjWlO+k1CL8r G1hZ2KhaLN8i03HZmfHnzY3IlDWcrWW5JOZ75aSlVDAfYSP8RogRI/y+lmQTpAFV hrOBffPhZ/BOFd7OEZeDVPkSMxO/p9FlsAzwd6iSehHxIgYP7m+3xKFi4Xzc2qkn WudJPyIt1Q9JfFAtg19XT00= Received: (qmail 36478 invoked by alias); 11 Jan 2016 12:24:09 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 36465 invoked by uid 89); 11 Jan 2016 12:24:08 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.0 required=5.0 tests=AWL, BAYES_00, RP_MATCHES_RCVD, SPF_PASS autolearn=ham version=3.3.2 spammy=1023, guard, 1022, Hx-languages-length:2364 X-HELO: fencepost.gnu.org Received: from fencepost.gnu.org (HELO fencepost.gnu.org) (208.118.235.10) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Mon, 11 Jan 2016 12:24:07 +0000 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39323) by fencepost.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1aIbW1-0000QG-LX for gcc-patches@gnu.org; Mon, 11 Jan 2016 07:24:05 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aIbVw-00029g-AM for gcc-patches@gnu.org; Mon, 11 Jan 2016 07:24:05 -0500 Received: from relay1.mentorg.com ([192.94.38.131]:38213) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aIbVw-00027v-4g for gcc-patches@gnu.org; Mon, 11 Jan 2016 07:24:00 -0500 Received: from nat-ies.mentorg.com ([192.94.31.2] helo=SVR-IES-FEM-01.mgc.mentorg.com) by relay1.mentorg.com with esmtp id 1aIbVn-0001k6-N4 from Tom_deVries@mentor.com ; Mon, 11 Jan 2016 04:23:52 -0800 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.3.224.2; Mon, 11 Jan 2016 12:23:49 +0000 From: Tom de Vries Subject: [Commited, PR69069] Add missing phi args in create_parallel_loop To: "gcc-patches@gnu.org" , Richard Biener Message-ID: <56939ED2.5020804@mentor.com> Date: Mon, 11 Jan 2016 13:23:46 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.4.0 MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Windows NT kernel [generic] [fuzzy] X-Received-From: 192.94.38.131 Hi, when doing an ftree-parallelize-loops=2 build (PR68967), I ran into an ICE building gcc/ada/g-debpoo.adb. The problem occurs when handling a loop with header bb 109, latch bb 108 and exit bb 110: ... ;; basic block 109 # ivtmp_520 = PHI <0(129), ivtmp_151(108)> # RANGE [0, 1022] NONZERO 1023 j_528 = (gnat__debug_pools__TheaderBD.4905) ivtmp_520; ivtmp_479 = 1023 - ivtmp_520; # RANGE [1, 1023] NONZERO 1023 j_529 = j_528 + 1; ivtmp_19 = ivtmp_479 - 1; if (ivtmp_520 < 1022) goto ; else goto ; ;; basic block 108 ivtmp_151 = ivtmp_520 + 1; goto ; ;; basic block 110 # .MEM_28 = PHI <.MEM_743(109), .MEM_743(126)> goto ; ... The phi defining .MEM_28 is a case of 'exit phi without corresponding loop header phi'. [ A patch was committed at r225873 to detect and handle this kind of situation, but it looks like it doesn't handle the virtual phi case correctly. ] After create_parallel_loop, we're left with missing arguments in the new loop exit phi: ... # .MEM_765 = PHI <(108), (135)> #pragma omp return(nowait) ... This causes an ssa verification failure at the start of rewrite_virtuals_into_loop_closed_ssa when parallelizing another loop in the same function. This patch fixes the problem by setting the missing phi arguments in create_parallel_loop. Bootstrapped and reg-tested on x86_64. Committed to trunk. Thanks, - Tom Add missing phi args in create_parallel_loop 2016-01-07 Tom de Vries PR tree-optimization/69069 * tree-parloops.c (create_parallel_loop): Add missing phi args. --- gcc/tree-parloops.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/gcc/tree-parloops.c b/gcc/tree-parloops.c index 5afaaf8..46d70ac 100644 --- a/gcc/tree-parloops.c +++ b/gcc/tree-parloops.c @@ -2086,7 +2086,12 @@ create_parallel_loop (struct loop *loop, tree loop_fn, tree data, value is not modified in the loop, and we're done with this phi. */ if (!(gimple_code (def_stmt) == GIMPLE_PHI && gimple_bb (def_stmt) == loop->header)) - continue; + { + locus = gimple_phi_arg_location_from_edge (phi, exit); + add_phi_arg (phi, def, guard, locus); + add_phi_arg (phi, def, end, locus); + continue; + } gphi *stmt = as_a (def_stmt); def = PHI_ARG_DEF_FROM_EDGE (stmt, loop_preheader_edge (loop));