From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by sourceware.org (Postfix) with ESMTPS id 5F04C385E00B for ; Fri, 27 Mar 2020 22:41:57 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 5F04C385E00B Received: from pps.filterd (m0098399.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 02RMWVv8113456; Fri, 27 Mar 2020 18:41:42 -0400 Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 3017jured8-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 27 Mar 2020 18:41:41 -0400 Received: from m0098399.ppops.net (m0098399.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.36/8.16.0.36) with SMTP id 02RMWeBF113702; Fri, 27 Mar 2020 18:41:41 -0400 Received: from ppma02dal.us.ibm.com (a.bd.3ea9.ip4.static.sl-reverse.com [169.62.189.10]) by mx0a-001b2d01.pphosted.com with ESMTP id 3017jured2-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 27 Mar 2020 18:41:41 -0400 Received: from pps.filterd (ppma02dal.us.ibm.com [127.0.0.1]) by ppma02dal.us.ibm.com (8.16.0.27/8.16.0.27) with SMTP id 02RMeT7d031447; Fri, 27 Mar 2020 22:41:40 GMT Received: from b03cxnp08026.gho.boulder.ibm.com (b03cxnp08026.gho.boulder.ibm.com [9.17.130.18]) by ppma02dal.us.ibm.com with ESMTP id 2ywaw332cj-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 27 Mar 2020 22:41:40 +0000 Received: from b03ledav003.gho.boulder.ibm.com (b03ledav003.gho.boulder.ibm.com [9.17.130.234]) by b03cxnp08026.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 02RMfbbJ57868606 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 27 Mar 2020 22:41:38 GMT Received: from b03ledav003.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id D651B6A058; Fri, 27 Mar 2020 22:41:37 +0000 (GMT) Received: from b03ledav003.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 310FA6A04D; Fri, 27 Mar 2020 22:41:37 +0000 (GMT) Received: from [9.160.53.188] (unknown [9.160.53.188]) by b03ledav003.gho.boulder.ibm.com (Postfix) with ESMTP; Fri, 27 Mar 2020 22:41:36 +0000 (GMT) To: GCC Patches Cc: "ian@airs.com" , Segher Boessenkool , Richard Biener From: Peter Bergner Subject: [PATCH] lower-subreg: PR94123, SVN r273240, causes gcc.target/powerpc/pr87507.c to fail Message-ID: <20ee8944-f0bf-cec1-e3d1-5dd5e9c6a4ef@linux.ibm.com> Date: Fri, 27 Mar 2020 17:41:36 -0500 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:68.0) Gecko/20100101 Thunderbird/68.6.0 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-TM-AS-GCONF: 00 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.138, 18.0.645 definitions=2020-03-27_08:2020-03-27, 2020-03-27 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 mlxscore=0 phishscore=0 malwarescore=0 priorityscore=1501 impostorscore=0 clxscore=1011 mlxlogscore=930 bulkscore=0 spamscore=0 lowpriorityscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2003020000 definitions=main-2003270181 X-Spam-Status: No, score=-20.1 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_DMARC_STATUS, RCVD_IN_DNSWL_LOW, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 27 Mar 2020 22:42:00 -0000 The pr87507.c test case regressed due to Segher's commit that added -fsplit-wide-types-early. The issue is that the lower-subreg pass only decomposes the TImode code in the example if there is a pseudo reg to pseudo reg copy. When the lower-subreg pass is called late (its old location), then combine changes the generated code by adding a TImode pseudo reg to pseudo reg copy and lower-subreg successfully decomposes it. When we run lower-subreg before combine, that copy isn't there so we do not decompose our TImode uses. I'm not sure why we require a pseudo to pseudo copy before we decompose things, but changing find_pseudo_copy to allow pseudo and hard regs to be copied into a pseudo like below fixes the issue. Ian, do you remember why we don't just decompose all wide types and instead require a pseudo to pseudo copy to exist? This patch survived bootstrap and regtesting on powerpc64le-linux with no regressions. * lower-subreg.c (find_pseudo_copy): Allow copies from hard registers too. diff --git a/gcc/lower-subreg.c b/gcc/lower-subreg.c index 4c8bc835f93..c6816a34489 100644 --- a/gcc/lower-subreg.c +++ b/gcc/lower-subreg.c @@ -419,7 +419,7 @@ find_pseudo_copy (rtx set) rd = REGNO (dest); rs = REGNO (src); - if (HARD_REGISTER_NUM_P (rd) || HARD_REGISTER_NUM_P (rs)) + if (HARD_REGISTER_NUM_P (rd)) return false; b = reg_copy_graph[rs]; Given we're late in stage4, the above patch (assuming it's ok) probably shouldn't go in until stage1, since it is changing lower-subreg's behaviour slightly. A different (ie, safer) approach would be to just rerun lower-subreg at its old location, regardless of whether we used -fsplit-wide-types-early. This way, we are not changing lower-subreg's behaviour, just running it an extra time (3 times instead of twice when using -fsplit-wide-types-early). I don't think lower-subreg is too expensive to run an extra time and we'd only do it when using -fsplit-wide-types-early. The only downside (if any) is that we don't decompose these TImode uses early like the patch above does, so combine, etc. can't see what they will eventually become. This does fix the bug and also survives bootstrap and regtesting on powerpc64le-linux with no regressions. * lower-subreg.c (pass_lower_subreg3::gate): Remove test for flag_split_wide_types_early. diff --git a/gcc/lower-subreg.c b/gcc/lower-subreg.c index 4c8bc835f93..807ad398b64 100644 --- a/gcc/lower-subreg.c +++ b/gcc/lower-subreg.c @@ -1844,8 +1844,7 @@ public: {} /* opt_pass methods: */ - virtual bool gate (function *) { return flag_split_wide_types - && !flag_split_wide_types_early; } + virtual bool gate (function *) { return flag_split_wide_types != 0; } virtual unsigned int execute (function *) { decompose_multiword_subregs (true); Does anyone have any preferences on the patches above or comments? If we go with the first patch for stage1, I'll add -fno-split-wide-types-early to pr87507.c so it doesn't FAIL until the patch goes in. Peter