From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 95543 invoked by alias); 9 Jun 2017 13:36:42 -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 95493 invoked by uid 89); 9 Jun 2017 13:36:41 -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,SPF_PASS autolearn=ham version=3.3.2 spammy=Hx-languages-length:1236 X-HELO: mail-oi0-f52.google.com Received: from mail-oi0-f52.google.com (HELO mail-oi0-f52.google.com) (209.85.218.52) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 09 Jun 2017 13:36:39 +0000 Received: by mail-oi0-f52.google.com with SMTP id k145so22082013oih.3 for ; Fri, 09 Jun 2017 06:36:43 -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; bh=P7jl1XvJ8T8BOztw1TojCH/f9TfyPElOVIC78HAVySM=; b=lNs0rg7alWSprHp8UmdkXqzssaBA1Wzif/dqkwxyapdTuxa5AfhTbbFEI25wPGiGdl dg/cRr9pVCR8DUxBQMQAbaC7AijjkbguGRFN+B4Do2FTbjzFtv1xp2OwHpBHMREsPxPz wFc0Z2JV0iQSfui61fw/GoE99r7lmtl0W+E8tyz1DCOK70qRKGlpQfX/4IwHwYQa0tA9 zn6tnYnLmX4BGhFHGslYWD6KAYz+ePRQZtQxRT7cZBI26kA2DDkbTzioxC7DCNrm5h8v Fto8BbfKHfCdAuOzbgtkF2L/GRWb37hXQidjJPsNKu/d/ti7LQ6qYvbnqurR0Vf5hP0g Jesw== X-Gm-Message-State: AODbwcBpvlN/TTkxsgWMwbtZx+X+ktrkiidjELalj/mRaCjQkbBE4e7w kCxYhEhlSHqhKWcGii4Qxgpljyu+Uw== X-Received: by 10.202.229.138 with SMTP id c132mr1987803oih.19.1497015402421; Fri, 09 Jun 2017 06:36:42 -0700 (PDT) MIME-Version: 1.0 Received: by 10.157.36.8 with HTTP; Fri, 9 Jun 2017 06:36:41 -0700 (PDT) In-Reply-To: <20170609130416.GI2154@tucnak> References: <96b534c4-988f-e958-f341-9674a60aeb1e@gmail.com> <656E3329-B549-490D-A87F-7421D424E781@gmail.com> <87936043-98aa-52e5-155b-38ecafca562c@gmail.com> <67a113e7-ee14-8afe-9deb-6c2c26927505@gmail.com> <132d2724-8e3a-bb1b-731f-0c0d1e7883d6@gmail.com> <20170609130416.GI2154@tucnak> From: Richard Biener Date: Fri, 09 Jun 2017 13:36:00 -0000 Message-ID: Subject: Re: [PATCH] handle bzero/bcopy in DSE and aliasing (PR 80933, 80934) To: Jakub Jelinek Cc: Martin Sebor , GCC Patches , Bernhard Reutner-Fischer Content-Type: text/plain; charset="UTF-8" X-IsSubscribed: yes X-SW-Source: 2017-06/txt/msg00650.txt.bz2 On Fri, Jun 9, 2017 at 3:04 PM, Jakub Jelinek wrote: > On Fri, Jun 09, 2017 at 02:35:45PM +0200, Richard Biener wrote: >> +static bool >> +gimple_fold_builtin_bcmp (gimple_stmt_iterator *gsi) >> +{ >> >> + /* Transform bcmp (a, b, len) into memcmp (a, b, len). */ >> + >> + gimple *stmt = gsi_stmt (*gsi); >> + tree a = gimple_call_arg (stmt, 0); >> + tree b = gimple_call_arg (stmt, 1); >> + tree len = gimple_call_arg (stmt, 2); >> + >> + gimple_seq seq = NULL; >> + gimple *repl = gimple_build_call (fn, 3, a, b, len); >> + gimple_seq_add_stmt_without_update (&seq, repl); >> + gsi_replace_with_seq_vops (gsi, seq); >> >> given they have the same prototype you can do like gimple_fold_builtin_stpcpy: >> >> gimple_call_set_fndecl (stmt, fn); >> fold_stmt (gsi); >> >> That works even with bcopy -> memmove if you swap arguments. > > Shouldn't it also update gimple_call_fntype though, at least for memmove? > Those differ with void const * vs. void * arguments, and also in the return > value. At least if the old fntype is compatible with the bcopy call. Yes. If the old fntype isn't compatible we don't reach the folding. Richard. > Jakub