From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 57111 invoked by alias); 9 Aug 2017 11:39:37 -0000 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 Received: (qmail 57039 invoked by uid 89); 9 Aug 2017 11:39:33 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-26.9 required=5.0 tests=BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,SPF_PASS autolearn=ham version=3.3.2 spammy=7307 X-HELO: mx1.suse.de Received: from mx2.suse.de (HELO mx1.suse.de) (195.135.220.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 09 Aug 2017 11:39:31 +0000 Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 984D1ABDD; Wed, 9 Aug 2017 11:39:25 +0000 (UTC) Subject: Re: [PATCH] Convert character arrays to string csts To: Richard Biener Cc: Jan Hubicka , Bernd Schmidt , GCC Patches References: <1a50afaa-6b8e-ba98-6cde-aae51c05a2c4@suse.cz> <1b1f844f-a20d-4702-27ea-59d718b8a99e@redhat.com> <20161103130057.GD52446@kam.mff.cuni.cz> <749c0fce-2c35-7f02-e130-7f04a4260ebf@suse.cz> <6adfa5f6-5576-9eee-2656-b2d25d0397f3@suse.cz> <5a0bd904-c8e5-da15-7411-44d297613121@suse.cz> <5157906E-0A85-46D6-99AE-63F48546418D@gmail.com> From: =?UTF-8?Q?Martin_Li=c5=a1ka?= Message-ID: Date: Wed, 09 Aug 2017 11:39:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 MIME-Version: 1.0 In-Reply-To: <5157906E-0A85-46D6-99AE-63F48546418D@gmail.com> Content-Type: multipart/mixed; boundary="------------44AB1AC1522208252A6872CE" X-IsSubscribed: yes X-SW-Source: 2017-08/txt/msg00658.txt.bz2 This is a multi-part message in MIME format. --------------44AB1AC1522208252A6872CE Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Content-length: 354 On 08/09/2017 11:43 AM, Richard Biener wrote: > I only have the patch I sent you so I can't re-diff. > > Richard. Hi. I'm sending rebased version of the patch. However the patch eats all my memory when e.g. building ../../../libgcc/libgcov-merge.c. If you have time, please try to make it working for &STRING_CST. I can continue then. Thanks, Martin --------------44AB1AC1522208252A6872CE Content-Type: text/x-patch; name="fix-pr50199-rebased.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="fix-pr50199-rebased.patch" Content-length: 3751 diff --git a/gcc/gimple-expr.c b/gcc/gimple-expr.c index c1771fcf1d0..eb22456c241 100644 --- a/gcc/gimple-expr.c +++ b/gcc/gimple-expr.c @@ -631,7 +631,7 @@ is_gimple_address (const_tree t) op = TREE_OPERAND (op, 0); } - if (CONSTANT_CLASS_P (op) || TREE_CODE (op) == MEM_REF) + if (TREE_CODE (op) == MEM_REF) return true; switch (TREE_CODE (op)) @@ -667,11 +667,10 @@ is_gimple_invariant_address (const_tree t) { const_tree op0 = TREE_OPERAND (op, 0); return (TREE_CODE (op0) == ADDR_EXPR - && (CONSTANT_CLASS_P (TREE_OPERAND (op0, 0)) - || decl_address_invariant_p (TREE_OPERAND (op0, 0)))); + && decl_address_invariant_p (TREE_OPERAND (op0, 0))); } - return CONSTANT_CLASS_P (op) || decl_address_invariant_p (op); + return decl_address_invariant_p (op); } /* Return true if T is a gimple invariant address at IPA level @@ -693,11 +692,10 @@ is_gimple_ip_invariant_address (const_tree t) { const_tree op0 = TREE_OPERAND (op, 0); return (TREE_CODE (op0) == ADDR_EXPR - && (CONSTANT_CLASS_P (TREE_OPERAND (op0, 0)) - || decl_address_ip_invariant_p (TREE_OPERAND (op0, 0)))); + && decl_address_ip_invariant_p (TREE_OPERAND (op0, 0))); } - return CONSTANT_CLASS_P (op) || decl_address_ip_invariant_p (op); + return decl_address_ip_invariant_p (op); } /* Return true if T is a GIMPLE minimal invariant. It's a restricted @@ -732,7 +730,7 @@ is_gimple_reg (tree t) if (virtual_operand_p (t)) return false; - if (TREE_CODE (t) == SSA_NAME) + if (TREE_CODE (t) == SSA_NAME || TREE_CODE (t) == CONST_DECL) return true; if (!is_gimple_variable (t)) @@ -825,8 +823,7 @@ is_gimple_mem_ref_addr (tree t) return (is_gimple_reg (t) || TREE_CODE (t) == INTEGER_CST || (TREE_CODE (t) == ADDR_EXPR - && (CONSTANT_CLASS_P (TREE_OPERAND (t, 0)) - || decl_address_invariant_p (TREE_OPERAND (t, 0))))); + && decl_address_invariant_p (TREE_OPERAND (t, 0)))); } /* Hold trees marked addressable during expand. */ diff --git a/gcc/gimple-expr.h b/gcc/gimple-expr.h index 6e969164a37..04de209c092 100644 --- a/gcc/gimple-expr.h +++ b/gcc/gimple-expr.h @@ -94,9 +94,7 @@ is_gimple_id (tree t) return (is_gimple_variable (t) || TREE_CODE (t) == FUNCTION_DECL || TREE_CODE (t) == LABEL_DECL - || TREE_CODE (t) == CONST_DECL - /* Allow string constants, since they are addressable. */ - || TREE_CODE (t) == STRING_CST); + || TREE_CODE (t) == CONST_DECL); } /* Return true if OP, an SSA name or a DECL is a virtual operand. */ diff --git a/gcc/gimplify.c b/gcc/gimplify.c index 86623e09f5d..d56d1dfe8ab 100644 --- a/gcc/gimplify.c +++ b/gcc/gimplify.c @@ -2871,7 +2871,8 @@ gimplify_compound_lval (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p, so as to match the min_lval predicate. Failure to do so may result in the creation of large aggregate temporaries. */ tret = gimplify_expr (p, pre_p, post_p, is_gimple_min_lval, - fallback | fb_lvalue); + expr_stack.length () > 0 + ? fb_lvalue : fallback | fb_lvalue); ret = MIN (ret, tret); /* And finally, the indices and operands of ARRAY_REF. During this @@ -11503,7 +11504,17 @@ gimplify_expr (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p, that in the GIMPLE IL. */ if (TREE_OVERFLOW_P (*expr_p)) *expr_p = drop_tree_overflow (*expr_p); - ret = GS_ALL_DONE; + + if (fallback & fb_rvalue) + ret = GS_ALL_DONE; + else + { + tree cdecl = build_decl (UNKNOWN_LOCATION, CONST_DECL, + NULL_TREE, TREE_TYPE (*expr_p)); + DECL_INITIAL (cdecl) = *expr_p; + *expr_p = cdecl; + ret = GS_OK; + } break; case CONST_DECL: --------------44AB1AC1522208252A6872CE--