From patchwork Tue Jun 7 10:38:26 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Alexandre Oliva X-Patchwork-Id: 99107 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]) by ozlabs.org (Postfix) with SMTP id 2D616B6FA6 for ; Tue, 7 Jun 2011 20:38:50 +1000 (EST) Received: (qmail 1571 invoked by alias); 7 Jun 2011 10:38:49 -0000 Received: (qmail 1563 invoked by uid 22791); 7 Jun 2011 10:38:48 -0000 X-SWARE-Spam-Status: No, hits=-5.8 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_HI, SPF_HELO_PASS, TW_TM, T_RP_MATCHES_RCVD, T_TVD_MIME_NO_HEADERS X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 07 Jun 2011 10:38:30 +0000 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p57AcTAn010841 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 7 Jun 2011 06:38:29 -0400 Received: from freie.oliva.athome.lsd.ic.unicamp.br (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id p57AcSZ7011497 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 7 Jun 2011 06:38:29 -0400 Received: from livre.localdomain (livre-to-gw.oliva.athome.lsd.ic.unicamp.br [172.31.160.19]) by freie.oliva.athome.lsd.ic.unicamp.br (8.14.4/8.14.4) with ESMTP id p57AcRGR020094; Tue, 7 Jun 2011 07:38:27 -0300 Received: from livre.localdomain (aoliva@localhost.localdomain [127.0.0.1]) by livre.localdomain (8.14.3/8.14.3/Debian-5+lenny1) with ESMTP id p57AcRam002726; Tue, 7 Jun 2011 07:38:27 -0300 Received: (from aoliva@localhost) by livre.localdomain (8.14.3/8.14.3/Submit) id p57AcQRu002724; Tue, 7 Jun 2011 07:38:26 -0300 From: Alexandre Oliva To: Richard Guenther Cc: gcc-patches@gcc.gnu.org Subject: Re: [vta, graphite?] propagate degenerate phi nodes into debug stmts References: <84fc9c000911080156iff6d687o26db10af3e9fba5d@mail.gmail.com> <84fc9c000911170739v76a2e911vc6794e597c8d134e@mail.gmail.com> <84fc9c000911190253v19390bd2le683c769bf0ab4d@mail.gmail.com> Date: Tue, 07 Jun 2011 07:38:26 -0300 In-Reply-To: (Richard Guenther's message of "Mon, 6 Jun 2011 11:37:06 +0200") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) MIME-Version: 1.0 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 On Jun 6, 2011, Richard Guenther wrote: >> You meant 4.6 stage1, but I missed it.  How's it for 4.7 stage1? >> Regstrapped on x86_64-linux-gnu and i686-linux-gnu. > Isn't exactly ICEing for num_ssa_operands/delink_stmt_imm_use. Uhh. Looks like I didn't update the patch per your comments before putting it aside for stage1, after all. Sorry. > So, the op_iter_init change is ok, the other two not - they should > either ICE or work for PHIs (by using FOR_EACH_PHI_OR_STMT_USE > in them). The latter is legitimately called for GIMPLE_PHI, so I changed it to use FOR_EACH_PHI_OR_STMT_USE. The former was never called for GIMPLE_PHIs, so I put in an assert there. Regstrapped on x86_64-linux-gnu and i686-linux-gnu. Ok? for gcc/ChangeLog from Alexandre Oliva * tree-flow-inline.h (op_iter_init): Reject GIMPLE_PHI stmts. (num_ssa_operands): Likewise. (op_iter_init_phiuse): Forward-declare. (delink_stmt_imm_use): Iterate with FOR_EACH_PHI_OR_STMT_USE. Index: gcc/tree-flow-inline.h =================================================================== --- gcc/tree-flow-inline.h.orig 2011-06-03 11:56:24.619482744 -0300 +++ gcc/tree-flow-inline.h 2011-06-07 04:15:18.344729725 -0300 @@ -737,9 +737,11 @@ clear_and_done_ssa_iter (ssa_op_iter *pt static inline void op_iter_init (ssa_op_iter *ptr, gimple stmt, int flags) { - /* We do not support iterating over virtual defs or uses without + /* PHI nodes require a different iterator initialization path. We + do not support iterating over virtual defs or uses without iterating over defs or uses at the same time. */ - gcc_checking_assert ((!(flags & SSA_OP_VDEF) || (flags & SSA_OP_DEF)) + gcc_checking_assert (gimple_code (stmt) != GIMPLE_PHI + && (!(flags & SSA_OP_VDEF) || (flags & SSA_OP_DEF)) && (!(flags & SSA_OP_VUSE) || (flags & SSA_OP_USE))); ptr->defs = (flags & (SSA_OP_DEF|SSA_OP_VDEF)) ? gimple_def_ops (stmt) : NULL; if (!(flags & SSA_OP_VDEF) @@ -868,11 +870,14 @@ num_ssa_operands (gimple stmt, int flags tree t; int num = 0; + gcc_checking_assert (gimple_code (stmt) != GIMPLE_PHI); FOR_EACH_SSA_TREE_OPERAND (t, stmt, iter, flags) num++; return num; } +static inline use_operand_p +op_iter_init_phiuse (ssa_op_iter *ptr, gimple phi, int flags); /* Delink all immediate_use information for STMT. */ static inline void @@ -882,7 +887,7 @@ delink_stmt_imm_use (gimple stmt) use_operand_p use_p; if (ssa_operands_active ()) - FOR_EACH_SSA_USE_OPERAND (use_p, stmt, iter, SSA_OP_ALL_USES) + FOR_EACH_PHI_OR_STMT_USE (use_p, stmt, iter, SSA_OP_ALL_USES) delink_imm_use (use_p); }