From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 94308 invoked by alias); 7 Jun 2017 08:23:44 -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 94296 invoked by uid 89); 7 Jun 2017 08:23:44 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.3 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: mail-oi0-f50.google.com Received: from mail-oi0-f50.google.com (HELO mail-oi0-f50.google.com) (209.85.218.50) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 07 Jun 2017 08:23:42 +0000 Received: by mail-oi0-f50.google.com with SMTP id p7so2578482oif.2 for ; Wed, 07 Jun 2017 01:23:46 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=oQIWtKeDMJrdr+RFWzN9P+6Wf7i4BdHgv3gkGAB3vCI=; b=J7a4YqZAYCtYDv1j3lCu79m4mHAnAhpHyYZc4jc5Zd3zH0QTws6T4I0ReiXA6GUKWB q5RajvpdBA4asmSbuXqdkXjf5D74o8iZ9qFGZ8xOeWSpPEavHtWumf+fALo0h8Y3dyKr YuggVT2CYsnaRel/BEqpiyI2lOrrlxKlbKJV3sPKwE4vS/XQLxHOamI4q86nPo/l3iqY GZmucz0yrYWClkmssz1CoKVQZQgU+BYwfX7QpC+KsvJPkJheZzagrT5s1dn+OE39CDik +BSuQaTmTcdtH9ly7ZXfoHPB1HHisrbeg6XxuXqxse8CNkfEaW+f7dkioziV0EcMm3CG H32w== X-Gm-Message-State: AODbwcCBvfGI8VuZpT2P0iKePOrgg109FQZu5uwoofMUxQ5ee1Wtt00S 4WhR0D2Yin3glCzQfI38XBSwob7F0g== X-Received: by 10.202.181.68 with SMTP id e65mr13880890oif.212.1496823825156; Wed, 07 Jun 2017 01:23:45 -0700 (PDT) MIME-Version: 1.0 Received: by 10.157.36.8 with HTTP; Wed, 7 Jun 2017 01:23:44 -0700 (PDT) In-Reply-To: References: From: Richard Biener Date: Wed, 07 Jun 2017 08:23:00 -0000 Message-ID: Subject: Re: [PATCH] handle bzero/bcopy in DSE and aliasing (PR 80933, 80934) To: Martin Sebor Cc: Gcc Patch List Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-IsSubscribed: yes X-SW-Source: 2017-06/txt/msg00398.txt.bz2 On Wed, Jun 7, 2017 at 5:26 AM, Martin Sebor wrote: >> Note I'd be _much_ more sympathetic to simply canonicalizing all of >> bzero and bcopy >> to memset / memmove and be done with all the above complexity. > > > Attached is an updated patch along these lines. Please let me > know if it matches your expectations. I think you attached the wrong patch. Richard. > FWIW, although I don't feel too strongly about bzero et al. I'm > not sure that this approach is the right one in general. It might > (slightly) simplify GCC itself, but other than the incidental code > generation improvement, it offers no benefit to users. In some > cases, it even degrades user experience by causing GCC issue > diagnostics that refer to functions that don't appear in the source > code, such as for: > > char d[1]; > > void* f (const void *p) > { > bzero (d, 7); > } > > warning: =E2=80=98__builtin_memset=E2=80=99 writing 7 bytes into a regi= on of size 1 > overflows the destination [-Wstringop-overflow=3D] > > For some functions like mempcpy it might even worse code overall > (slower and bigger). > > In other cases (like profiling) it loses interesting information. > > I think these types of transformations would be justified f they > were done based on measurably improved efficiency of the generated > code, but I'm uneasy about swapping calls to one function for another > solely because it simplifies the implementation. Not least because > it doesn't seem like a viable general approach to simplifying the > implementation. > > Martin > > PS I stopped short of simplifying GCC to remove the existing special > handling of these three built-ins. If the patch is approved I'm > willing to do the cleanup in a subsequent pass.