From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm1-x331.google.com (mail-wm1-x331.google.com [IPv6:2a00:1450:4864:20::331]) by sourceware.org (Postfix) with ESMTPS id 964973A517B0 for ; Wed, 5 Jun 2024 13:58:36 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 964973A517B0 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 964973A517B0 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::331 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1717595919; cv=none; b=C/S2JL154v3519/+1xVG5HghYU1Xlb/wQA+8Y00LJ7NzG9YkIdO8vg8X0BxjfJNxcS3cW5xHhgCjMr9bZ8VT2etnT+f2Tmc3TE7dnXmzHbQzCCrCaTWU7zVz5JGOoMqvZyCj4h9PgwSg+AZOd8iKDa4MXW81/7pO2LMxt5UUuYg= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1717595919; c=relaxed/simple; bh=s7COTxfPUsoCF24GVEsgTXYHHJI6H14rBOcXIIN+uxM=; h=DKIM-Signature:Message-ID:Date:MIME-Version:Subject:To:From; b=uBL5vgC8cf36z846s3Q7Y3epBTl+3+e+bvLDxb35AMfp4wptjld3Z598BMTb3zIW/Kf+nhrnr3l9uTXxJ2+4+WlJUa8TFDhfPvYJBrfGHk/WBtGlbtsUW+nl94cdI05XktKr6o8mOPsQwauiy8+UEQ2cS8tRxYeSfbnk8oh5UYw= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-wm1-x331.google.com with SMTP id 5b1f17b1804b1-42135a45e2aso37039435e9.3 for ; Wed, 05 Jun 2024 06:58:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1717595915; x=1718200715; darn=gcc.gnu.org; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=tWaLcBP8b40lbDoZtM2eNhtPUetEVtcPsckBU0f4t/0=; b=YRVn8z8FZWNwYRVHnijSyzr0SP6k+7AfH2bOOn/Glir+5K5awCK7xJNvvC69PyQhru D1Rqwi53KvenUkvQi2espHlWLTMEOa2PjWqEFLVpTCGre8Paw6lv+fV6ZC+eSDFf4TKs SFXmzsw2wrrTHtYR5sm9V8OK3ZbzggnprGxac7M2ex7i1RL0MPNZRK7LwXH5vox743Sj R2VagO9jZKrGrL2EjHx65TpCxi01lt5he8qcITEwRuUtncXY2NSAM4mNVN/as20+cPFO eO8QzDFvNxPjl2k0MXBS+CRjNxHVi3sL+JydFa1iJP4YzCjFNxs78+GnkIQkUFtdhpK7 M3wQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717595915; x=1718200715; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=tWaLcBP8b40lbDoZtM2eNhtPUetEVtcPsckBU0f4t/0=; b=PrwFn7hLvTDeaR87cA8+skcHtJA1B+Azano9qfEYWZFQ+LJ6RoyZiVC5vuOzM3Frp7 vc7Q+0RY2eGR89ONXQJ2kxssnGt+t6BYCCpgT0qMBpAbLsXUlhcdjwhxPQmWQDTlNBUk O2b/LTJ1ODrF89AssyGBu0Z5QonWOYk8Tk5zlVf6ET0/g8rtyuRMDRkOxZrNYInnyn0R /tc4cbCKNdEVE4epTu9DEe3lQ/57FIII6tWMiltZNCQrVO+rGLAGMKQtwZLnLI4Rnfc0 O4Ggp4PrbXnYOP+bn2dwfpGNKkeo7x8k8esV0Ioj1mxqpKf7By5d/VMQnQAh3rbyeYxM LPfA== X-Gm-Message-State: AOJu0YyoXObJKydxspEkPq5okNSM0OColUc3yC+ArD1WjxVFcGN9vcXu osxSLHiDPaKufDkYGeHEJrFl44dBNZFoOQ5J94JhvDGQU+DXL9eM X-Google-Smtp-Source: AGHT+IHzC4P78MRHmOhemO4MpQ7F1IX6+/VX8JT0EWmVZGTf3zsqIVnFlk5C7164VJKERs7IWkAbxg== X-Received: by 2002:a5d:59a8:0:b0:355:673:dd95 with SMTP id ffacd0b85a97d-35e8ef08aebmr2556070f8f.38.1717595915061; Wed, 05 Jun 2024 06:58:35 -0700 (PDT) Received: from [172.31.0.109] ([136.36.72.243]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4215813c9c3sm22530225e9.43.2024.06.05.06.58.33 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 05 Jun 2024 06:58:34 -0700 (PDT) Message-ID: <7b05a5c0-ccb6-4ea4-b42a-4c74a70f483f@gmail.com> Date: Wed, 5 Jun 2024 07:58:30 -0600 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Beta Subject: Re: [PATCH 0/2] fix RISC-V zcmp popretz [PR113715] Content-Language: en-US To: Fei Gao , Kito Cheng Cc: gcc-patches , Palmer Dabbelt References: <20240605015024.7845-1-gaofei@eswincomputing.com> <2024060515473154362425@eswincomputing.com> From: Jeff Law In-Reply-To: <2024060515473154362425@eswincomputing.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.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,T_SCC_BODY_TEXT_LINE 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 6/5/24 1:47 AM, Fei Gao wrote: > > On 2024-06-05 14:36  Kito Cheng wrote: >> >> Thanks for fixing this issue, and I am wondering doest it possible to >> fix that without introduce target hook? I ask that because...GCC 14 >> also has this bug, but I am not sure it's OK to introduce new target >> hook for release branch? or would you suggest we just revert patch to >> fix that on GCC 14? > > If hook is unacceptable in GCC14, I suggest to revert on GCC 14 the following commit. > https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=b27d323a368033f0b37e93c57a57a35fd9997864 > > I started fixing this issue by adding changes in mach pass but abandoned it > due to the following reasons: > 1. more codes to detect location of epilogue in the whole insn list. > 2. due to impact by scheduling pass, clear a0 and use a0 insns get reordered, resulting in more >     codes. > 3. data flow analysis is needed, but insn does't have bb info any more, so rescan actually does >     nothing, which I guess there's some hidden issue in riscv_remove_unneeded_save_restore_calls >     using dfa. > > So I came up this hook based patch in prologue and epilogue pass to make the optimization > happen as earlier as possible. It ends up with simplicity and clear logic. But let's back up and get a good explanation of what the problem is. Based on patch 2/2 it looks like we have lost an assignment to the return register. To someone not familiar with this code, it sounds to me like we've made a mistake earlier and we're now defining a hook that lets us go back and fix that earlier mistake. I'm probably wrong, but so far that's what it sounds like. So let's get a good explanation of the problem and perhaps we'll find a better way to solve it. jeff