From patchwork Mon Oct 26 09:36:24 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Sandiford X-Patchwork-Id: 535776 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 688AA140E4A for ; Mon, 26 Oct 2015 20:36:47 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=q6rlObMI; 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 :to:subject:date:message-id:mime-version:content-type :content-transfer-encoding; q=dns; s=default; b=S/vahl9oNMwJQTX3 GpQI5l2p10H2JwGnejBz7rI3LGvThRLLVaTzh0hYaSAN1Pp/n7gVGQ1Mj3wIOb+P ZyZmeOwIb38waLXKJuDv/8IWqMleLPJBMh8KFcREPcU87ym/b6JTXglYKDO0jtDM IbCh9vgmLgmTn/0Vemo3CrDWCM0= 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 :to:subject:date:message-id:mime-version:content-type :content-transfer-encoding; s=default; bh=p++qYCM5IjP7sMXADkvxdC Fjhe8=; b=q6rlObMIojQxkATiK/Mkode39DHyoBITrj6emN+2HoA3LEUHDG38uB TPQibc4aOMQI6uTzBO1vov9l9Rn3TYouio7U1XFafFAkCOcUBa7hSffV0lwgsWzi +XbthYGItpOJTGUmmEQcZ8qIQ9/wFLJdYmNWnuYIkXgh9AYAJMDOM= Received: (qmail 64080 invoked by alias); 26 Oct 2015 09:36:35 -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 64029 invoked by uid 89); 26 Oct 2015 09:36:31 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.2 required=5.0 tests=BAYES_00, FREEMAIL_FROM, SPF_SOFTFAIL autolearn=no version=3.3.2 X-HELO: eu-smtp-delivery-143.mimecast.com Received: from eu-smtp-delivery-143.mimecast.com (HELO eu-smtp-delivery-143.mimecast.com) (146.101.78.143) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 26 Oct 2015 09:36:30 +0000 Received: from cam-owa1.Emea.Arm.com (fw-tnat.cambridge.arm.com [217.140.96.140]) by eu-smtp-1.mimecast.com with ESMTP id uk-mta-23-DEhjWP-oTW2OdAniVgfZHg-1; Mon, 26 Oct 2015 09:36:24 +0000 Received: from localhost ([10.1.2.79]) by cam-owa1.Emea.Arm.com with Microsoft SMTPSVC(6.0.3790.3959); Mon, 26 Oct 2015 09:36:24 +0000 From: Richard Sandiford To: gcc-patches@gcc.gnu.org Mail-Followup-To: gcc-patches@gcc.gnu.org, richard.sandiford@arm.com Subject: Don't create SSA names until in SSA form Date: Mon, 26 Oct 2015 09:36:24 +0000 Message-ID: <871tcix97r.fsf@e105548-lin.cambridge.arm.com> User-Agent: Gnus/5.130012 (Ma Gnus v0.12) Emacs/24.3 (gnu/linux) MIME-Version: 1.0 X-MC-Unique: DEhjWP-oTW2OdAniVgfZHg-1 An upcoming patch adds a fold from hypot(x,x) to fabs(x)*sqrt(2). This is unusual in that it could trigger in the gimplifier but would require new SSA names to be created. This patch makes sure that we don't try to create new SSA names when we're not yet in SSA form. Tested on x86_64-linux-gnu, aarch64-linux-gnu and arm-linux-gnueabi. OK to install? Thanks, Richard gcc/ * gimple-match-head.c (maybe_push_res_to_seq): Don't attempt to create new SSA names if not in SSA form. diff --git a/gcc/gimple-match-head.c b/gcc/gimple-match-head.c index 8f72919..1345cf9 100644 --- a/gcc/gimple-match-head.c +++ b/gcc/gimple-match-head.c @@ -331,7 +331,11 @@ maybe_push_res_to_seq (code_helper rcode, tree type, tree *ops, && SSA_NAME_OCCURS_IN_ABNORMAL_PHI (ops[2]))) return NULL_TREE; if (!res) - res = make_ssa_name (type); + { + if (!gimple_in_ssa_p (cfun)) + return NULL_TREE; + res = make_ssa_name (type); + } maybe_build_generic_op (rcode, type, &ops[0], ops[1], ops[2]); gimple *new_stmt = gimple_build_assign (res, rcode, ops[0], ops[1], ops[2]); @@ -361,7 +365,11 @@ maybe_push_res_to_seq (code_helper rcode, tree type, tree *ops, } gcc_assert (nargs != 0); if (!res) - res = make_ssa_name (type); + { + if (!gimple_in_ssa_p (cfun)) + return NULL_TREE; + res = make_ssa_name (type); + } gimple *new_stmt = gimple_build_call (decl, nargs, ops[0], ops[1], ops[2]); gimple_call_set_lhs (new_stmt, res); gimple_seq_add_stmt_without_update (seq, new_stmt);