From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by sourceware.org (Postfix) with ESMTP id E823D3858C5E for ; Thu, 12 Oct 2023 14:19:09 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org E823D3858C5E Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 6E2BA13D5; Thu, 12 Oct 2023 07:19:50 -0700 (PDT) Received: from localhost (unknown [10.32.110.65]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 3851A3F5A1; Thu, 12 Oct 2023 07:19:09 -0700 (PDT) From: Richard Sandiford To: Robin Dapp via Gcc-patches Mail-Followup-To: Robin Dapp via Gcc-patches ,Robin Dapp , richard.sandiford@arm.com Cc: Robin Dapp Subject: Re: [PATCH] gimple-match: Do not try UNCOND optimization with COND_LEN. References: <4b77e155-0936-67d6-ab2d-ae7ef49bfde0@gmail.com> <4afb967d-96ea-7e74-1a35-c86aa5a5ffa6@gmail.com> Date: Thu, 12 Oct 2023 15:19:08 +0100 In-Reply-To: (Richard Sandiford's message of "Thu, 12 Oct 2023 14:53:46 +0100") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Status: No, score=-18.2 required=5.0 tests=BAYES_00,KAM_DMARC_NONE,KAM_DMARC_STATUS,KAM_LAZY_DOMAIN_SECURITY,SPF_HELO_NONE,SPF_NONE,TXREP autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: Richard Sandiford writes: > Robin Dapp via Gcc-patches writes: >> [...] >> @@ -386,9 +390,29 @@ try_conditional_simplification (internal_fn ifn, gimple_match_op *res_op, >> default: >> gcc_unreachable (); >> } >> - *res_op = cond_op; >> - maybe_resimplify_conditional_op (seq, res_op, valueize); >> - return true; >> + >> + if (len) >> + { >> + /* If we had a COND_LEN before we need to ensure that it stays that >> + way. */ >> + gimple_match_op old_op = *res_op; >> + *res_op = cond_op; >> + maybe_resimplify_conditional_op (seq, res_op, valueize); >> + >> + auto cfn = combined_fn (res_op->code); >> + if (internal_fn_p (cfn) >> + && internal_fn_len_index (as_internal_fn (cfn)) != -1) >> + return true; > > Why isn't it enough to check the result of maybe_resimplify_conditional_op? Sorry, ignore that part. I get it now. But isn't the test whether res_op->code itself is an internal_function? In other words, shouldn't it just be: if (internal_fn_p (res_op->code) && internal_fn_len_index (as_internal_fn (res_op->code)) != -1) return true; maybe_resimplify_conditional_op should already have converted to an internal function where possible, and if combined_fn (res_op->code) does any extra conversion on the fly, that conversion won't be reflected in res_op. Thanks, Richard