From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13166 invoked by alias); 17 Aug 2018 13:50:36 -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 13157 invoked by uid 89); 17 Aug 2018 13:50:35 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-25.2 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.2 spammy=HTo:U*ebotcazou, HX-Received:sk:q13-v6m, usw, usy X-HELO: mail-lj1-f193.google.com Received: from mail-lj1-f193.google.com (HELO mail-lj1-f193.google.com) (209.85.208.193) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 17 Aug 2018 13:50:33 +0000 Received: by mail-lj1-f193.google.com with SMTP id 203-v6so6397352ljj.13 for ; Fri, 17 Aug 2018 06:50:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=IhzbSoU0TGL8xbcV13zXhrPLEPwlW/vuxNMDG5pt74k=; b=qtGpI6shwTknbb+vMHZjEuL54bQb9zo7D8+h/J+LA8Ve2f9lJkTMynr3HaQQDei/tu 7cLwqvhoR0yzijkrtA5eNEX67CqYwZBUryalsgBmqJcT7kByw8hjs4GxBLcM3+uolyYm NOVL6wfuNWHl9MXNq6+59nULusM3FF+gWdKa2hWC6qjod2H45YJEvGUybxnOkquocSB2 hP+dcWLJNL1ly9jVH7eEnnRkO2zMZd+5lNSBg4k/r8a+JP6UfQd7EFVod3wNvnsq1DoA mxnCI0Sbv99XUKmkDE81WqY3ku7eIKoWHbsrb/3bMDTHGZefQkFJ+Y9uL40nAr7RCYfd ZBdA== MIME-Version: 1.0 References: <20180807113526.15097-1-krebbel@linux.ibm.com> In-Reply-To: <20180807113526.15097-1-krebbel@linux.ibm.com> From: Richard Biener Date: Fri, 17 Aug 2018 13:50:00 -0000 Message-ID: Subject: Re: [PATCH] PR86844: Fix for store merging To: krebbel@linux.ibm.com, Eric Botcazou Cc: GCC Patches , Andreas Krebbel Content-Type: text/plain; charset="UTF-8" X-IsSubscribed: yes X-SW-Source: 2018-08/txt/msg01027.txt.bz2 On Tue, Aug 7, 2018 at 1:35 PM Andreas Krebbel wrote: > > From: Andreas Krebbel > > Bootstrapped and regtested on s390x and x86_64. Eric, didn't your patches explicitely handle this case of a non-constant inbetween? Can you have a look / review here? Thanks, Richard. > gcc/ChangeLog: > > 2018-08-07 Andreas Krebbel > > PR tree-optimization/86844 > * gimple-ssa-store-merging.c (check_no_overlap): Add a check to > reject overlaps if it has seen a non-constant store in between. > > gcc/testsuite/ChangeLog: > > 2018-08-07 Andreas Krebbel > > PR tree-optimization/86844 > * gcc.dg/pr86844.c: New test. > --- > gcc/gimple-ssa-store-merging.c | 8 +++++++- > gcc/testsuite/gcc.dg/pr86844.c | 42 ++++++++++++++++++++++++++++++++++++++++++ > 2 files changed, 49 insertions(+), 1 deletion(-) > create mode 100644 gcc/testsuite/gcc.dg/pr86844.c > > diff --git a/gcc/gimple-ssa-store-merging.c b/gcc/gimple-ssa-store-merging.c > index 0ae4581..2abef2e 100644 > --- a/gcc/gimple-ssa-store-merging.c > +++ b/gcc/gimple-ssa-store-merging.c > @@ -2401,13 +2401,19 @@ check_no_overlap (vec m_store_info, unsigned int i, > unsigned HOST_WIDE_INT end) > { > unsigned int len = m_store_info.length (); > + bool seen_group_end_store_p = false; > + > for (++i; i < len; ++i) > { > store_immediate_info *info = m_store_info[i]; > if (info->bitpos >= end) > break; > + if (info->rhs_code != INTEGER_CST) > + seen_group_end_store_p = true; > if (info->order < last_order > - && (rhs_code != INTEGER_CST || info->rhs_code != INTEGER_CST)) > + && (rhs_code != INTEGER_CST > + || info->rhs_code != INTEGER_CST > + || seen_group_end_store_p)) > return false; > } > return true; > diff --git a/gcc/testsuite/gcc.dg/pr86844.c b/gcc/testsuite/gcc.dg/pr86844.c > new file mode 100644 > index 0000000..9ef08e9 > --- /dev/null > +++ b/gcc/testsuite/gcc.dg/pr86844.c > @@ -0,0 +1,42 @@ > +/* { dg-do run } */ > +/* { dg-require-effective-target stdint_types } */ > +/* { dg-options "-O1 -fstore-merging" } */ > + > +#include > + > +struct foo > +{ > + union > + { > + uint32_t u4i; > + > + struct > + { > + uint8_t x; > + uint8_t y; > + uint8_t z; > + uint8_t w; > + } s; > + } u; > + uint8_t v; > +}; > + > +void __attribute__((noinline,noclone)) > +f (struct foo *a) > +{ > + a->u.u4i = 0; > + a->u.s.w = 222; > + a->u.s.y = 129; > + a->u.s.z = a->v; > +} > + > +int > +main () > +{ > + struct foo s; > + > + f (&s); > + > + if (s.u.s.w != 222) > + __builtin_abort (); > +} > -- > 2.9.1 >