From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ed1-x534.google.com (mail-ed1-x534.google.com [IPv6:2a00:1450:4864:20::534]) by sourceware.org (Postfix) with ESMTPS id 943243858C53 for ; Wed, 21 Sep 2022 22:02:46 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 943243858C53 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-ed1-x534.google.com with SMTP id f20so10812999edf.6 for ; Wed, 21 Sep 2022 15:02:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date; bh=gZAG9I159Uk/o5e/K5PAQtXRqQJjN8FaagLTq0ktjIs=; b=DF0ROolJgfG2TTygnDukynoXkEKXfMhryHRHTTkOzv/q2I2pnOoV/fVn++syvp0WTo 7ed5QlNmv/UXVhlmYSthMCHR+VvkHgXSmfRa/lwNTLmmk0cuiSQYoG7X/kGyCOvQtymo 0nWgIGIyCMupe4w853dhIRpe+vTrcXcftS/3mpTpwllLx4uCyZnJXGXiYWaA1rh/4FIt PhblB0uLyDHp42y3MLIF4JZK4F0CylFdzT5U/OcWy+asbBEHQqhVvI/enYj21/BCkuRL 6woctrknOmsKdkNiGMTwBidqOr3iaMkFDRqHJCkSFHK6KW0SMBvdkeXQG/EWtWRMPAED 9hnA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date; bh=gZAG9I159Uk/o5e/K5PAQtXRqQJjN8FaagLTq0ktjIs=; b=iW6jpmT8LjWJ9eAY5Hvfd21DJhituv40bWtacmvQ8QHO4N7Z8dBLoPe/pczIC31tJC yDl6gfyYTEl/KknZxVsxZLhNPgh3ircf325pITj3Xd24HBVOn26xejrCNupqrJZ1wnIi FmdZklYbiPuNvMfxZVVCLO5e8nfzspvzXD0AKST+AW7qkO1t9v9E/HdOWiMhZ63wD3pA enLEryupXMwJt1Qu4dTqcCON/UmEPnBpGxnWhJDY5T7OibTzGY1xXGA4OzGvtjsShsfH WBTxz89fiwsZRKsUErIIQwfKZE90fFp3r9odDvBHjKTA3j7sdutLHxftOugSM8wEDxhj l7CQ== X-Gm-Message-State: ACrzQf1uE4KDOs3kDOMiG2bCXNo+Fptz6zflq/jxUNlyX9nUCK51hxtW wZ7EkPiashH6aH5pz8I7hZrV7oBK4Cu8uMshoaE= X-Google-Smtp-Source: AMsMyM7937RYfVBoGe+gtsOlpG/4FQ5eYPAjcDK+f72QjMmKQpUhSR8V0Ca/Nh3A/4LAdRWFT2Q0iP9mG9rKxsPk9mQ= X-Received: by 2002:a50:ea89:0:b0:453:8b7d:12e8 with SMTP id d9-20020a50ea89000000b004538b7d12e8mr233963edo.148.1663797765041; Wed, 21 Sep 2022 15:02:45 -0700 (PDT) MIME-Version: 1.0 References: <20220620163536.2653437-1-goldstein.w.n@gmail.com> <20220621181215.2942551-1-goldstein.w.n@gmail.com> <74183249-3937-af58-207f-ec41333384d2@gmail.com> In-Reply-To: <74183249-3937-af58-207f-ec41333384d2@gmail.com> From: Noah Goldstein Date: Wed, 21 Sep 2022 15:02:33 -0700 Message-ID: Subject: Re: [PATCH v3] tree-optimization/95821 - Convert strlen + strchr to memchr To: Jeff Law Cc: gcc-patches List Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-3.4 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,KAM_SHORT,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On Sat, Jul 9, 2022 at 8:59 AM Jeff Law via Gcc-patches wrote: > > > > On 6/21/2022 12:12 PM, Noah Goldstein via Gcc-patches wrote: > > This patch allows for strchr(x, c) to the replace with memchr(x, c, > > strlen(x) + 1) if strlen(x) has already been computed earlier in the > > tree. > > > > Handles PR95821: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95821 > > > > Since memchr doesn't need to re-find the null terminator it is faster > > than strchr. > > > > bootstrapped and tested on x86_64-linux. > > > > PR tree-optimization/95821 > > > > gcc/ > > > > * tree-ssa-strlen.cc (strlen_pass::handle_builtin_strchr): Emit > > memchr instead of strchr if strlen already computed. > > > > gcc/testsuite/ > > > > * c-c++-common/pr95821-1.c: New test. > > * c-c++-common/pr95821-2.c: New test. > > * c-c++-common/pr95821-3.c: New test. > > * c-c++-common/pr95821-4.c: New test. > > * c-c++-common/pr95821-5.c: New test. > > * c-c++-common/pr95821-6.c: New test. > > * c-c++-common/pr95821-7.c: New test. > > * c-c++-common/pr95821-8.c: New test. > Given Jakub's involvement to-date and the fact this touches > tree-ssa-strlen.cc I think Jakub should have final ACK/NAK on this. > > jeff > Ping.