From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-io1-xd32.google.com (mail-io1-xd32.google.com [IPv6:2607:f8b0:4864:20::d32]) by sourceware.org (Postfix) with ESMTPS id 17C673858CD1 for ; Wed, 20 Dec 2023 20:30:23 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 17C673858CD1 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 17C673858CD1 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::d32 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1703104224; cv=none; b=TJKcxs4aUACT3VZgqfnJClVUI7GlGRZJ6wq04PCnnVImjgQnxQmjNQd4i2bkNAEkYr4sf2UPLx9p3t0RQVaipUnI7V6kHMZ3yPrKUOAte5N0FuKGac2N9KgSSLsmu01ZC4RWyh3zyaTwhIwaCFedMSrvYHk3G8071AiAca9NIco= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1703104224; c=relaxed/simple; bh=0Xel0pnTqksM2FlJ+AWhmdVG7tyPlBLCJOe9CTnkG2w=; h=DKIM-Signature:Message-ID:Date:MIME-Version:Subject:To:From; b=aPuYJyUTB6gsyNhzgS6C2cHBboLE9+6REf4yJYcY0e/teuFryb2Qh+9Z2I87kWAVyeZTyP8aHC0rAkt45dnliR80/g8vFnAJR5LJa931iXrYgEiuFT1lhvT1yJV+v2jxdVJ28zUSkyS8fZfP/bI6GZ4vD/g16ksuADczP6+7GEI= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-io1-xd32.google.com with SMTP id ca18e2360f4ac-7b71e389fb2so1687439f.3 for ; Wed, 20 Dec 2023 12:30:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1703104222; x=1703709022; 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=O2mkoB53oybp3bWPhqRU/4leOBgk5mkPsKzP0TnZ0kU=; b=kmcA5fAd9v0BHaKHHJF5MqQ+EhaaSZZcDYpgAVay21F0m4LdhH2/eXLyNZ4Ps6uVxc jpjf2W6XGJ/Hl6yG7d7yd6XVo6lkmimeXxa8a8lUInCyQg/ej7Zq21oZCMzZRJ3Ao6kE pGEfyZYSB8ZIo4ZD6GB6T3CHYCClRf+2Mebc/kehI7C9BzkDlhG4lBWx+ZV2zjq+ZZa3 2q5BBKA0gp5SSlgeWxrCRgbdowjXzJk8YqI4tPvjBBMpBTYosXAOIoOSkCzhZ6s04sLm SGDeIiFWcJXRBq+z7y2AvHnSYptQ8pdLJ1KVpgV+4nLDOBnwg86j5P5F1o/9yq9NYlge GfXw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1703104222; x=1703709022; 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=O2mkoB53oybp3bWPhqRU/4leOBgk5mkPsKzP0TnZ0kU=; b=rV1JhN0EC4kqPwkHyTn7J2YvEV3Md1P2WEVmDjerymsUvvKw46J+NvjEMVcPyY+GPY 4HSWQEWhG/YkzaQnOGKh3WuRbhJnV5rrVo4ZYaAr0ToM1/mqCa8jR9aiIQpFVxBi+1ua 5As/uzJd4WxcxKneiIv0f8TXUfFjOzt4iXozPoc8ecXrOTAWNjvzgudvkYkbiLLcoCVe O6Xcf2uzJV4vn7RVceKb4uXuWZyrJs/lso+7U7ej6vWB1Qpibs6g0czRz0rW5iD/WHeV KVJVaX8UDJmD2uLZQhP4SZ9K1MwAMz9uiWS3xtbVCkmEE5FUqSHGMBemOIM+Kt1NXC0F sRFg== X-Gm-Message-State: AOJu0Yzv0nGQhgTFlg3nPBAyspmoIPFbjxerp2eXv+KGUvapm97WPekO +QF7ia3eZIAJzT8xim7E9QY= X-Google-Smtp-Source: AGHT+IFIszhNyXu88fcxV5aCtL8BjPadvtDNJVpMngf1LAStgcP0by0eZ8sz2ESjtMDmYNqOz06byQ== X-Received: by 2002:a05:6602:2e93:b0:7b6:ff1b:8b8d with SMTP id m19-20020a0566022e9300b007b6ff1b8b8dmr30996983iow.7.1703104222274; Wed, 20 Dec 2023 12:30:22 -0800 (PST) Received: from [172.31.0.109] ([136.36.72.243]) by smtp.gmail.com with ESMTPSA id p21-20020a056602305500b007b3e503d59csm81413ioy.47.2023.12.20.12.30.21 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 20 Dec 2023 12:30:21 -0800 (PST) Message-ID: <54424e42-cc7e-4d8d-a6dd-4566acaebf09@gmail.com> Date: Wed, 20 Dec 2023 13:30:20 -0700 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] sel-sched: Verify change before replacing dest in EXPR_INSN_RTX [PR112995] Content-Language: en-US To: "Kewen.Lin" , GCC Patches Cc: Andrey Belevantsev , Alexander Monakov , Peter Bergner , Segher Boessenkool References: <834db636-da81-ded9-3385-ae65a4cb7c91@linux.ibm.com> From: Jeff Law In-Reply-To: <834db636-da81-ded9-3385-ae65a4cb7c91@linux.ibm.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.5 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 12/15/23 01:52, Kewen.Lin wrote: > Hi, > > PR112995 exposed one issue in current try_replace_dest_reg > that the result rtx insn after replace_dest_with_reg_in_expr > is probably unable to match any constraints. Although there > are some checks on the changes onto dest or src of orig_insn, > none is performed on the EXPR_INSN_RTX. > > This patch is to add the check before actually replacing dest > in expr with reg. > > Bootstrapped and regtested on x86_64-redhat-linux and > powerpc64{,le}-linux-gnu. > > Is it ok for trunk? > > BR, > Kewen > ----- > PR rtl-optimization/112995 > > gcc/ChangeLog: > > * sel-sched.cc (try_replace_dest_reg): Check the validity of the > replaced insn before actually replacing dest in expr. > > gcc/testsuite/ChangeLog: > > * gcc.target/powerpc/pr112995.c: New test. Setting aside whether or not we should just deprecate/remove sel-sched for now.... From the PR: > with moving up, we have: > > (insn 46 0 0 (set (reg:DI 64 0 [135]) > (sign_extend:DI (reg/v:SI 64 0 [orig:119 c ] [119]))) 31 {extendsidi2} > (expr_list:REG_DEAD (reg/v:SI 9 9 [orig:119 c ] [119]) > (nil))) > > in try_replace_dest_reg, we updated the above EXPR_INSN_RTX to: > > (insn 48 0 0 (set (reg:DI 32 0) > (sign_extend:DI (reg/v:SI 64 0 [orig:119 c ] [119]))) 31 {extendsidi2} > (nil)) > > This doesn't match any constraint and it's an unexpected modification. It would have been helpful to include that in the patch, along with the fact that (reg 32) and (reg 64) are FP and VREGs respectively. That makes it clearer why the constraints might not match after the change. OK for the trunk. jeff