From patchwork Tue Feb 11 08:01:37 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Kewen.Lin" X-Patchwork-Id: 1236195 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-519321-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=linux.ibm.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.a=rsa-sha1 header.s=default header.b=adyXz7uA; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 48GwGZ5PS8z9sRL for ; Tue, 11 Feb 2020 19:01:58 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:to:cc :from:subject:date:mime-version:content-type:message-id; q=dns; s=default; b=OZl9+TM6yCtkzMwXf/uwoZ5vMKyfyj5lOAlIUxlMe00E3hb/IY UGU5uYCCp2XkdzlK+BQQSt474lmBoregNdwTIDtFCljPuha9Xheeko3eXkLPvv4H GAE8DnNE9T/raMTIPZnNHi0vn4vSpzqYkLScf6Mzfqq7DYSYZWrBBHL7o= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:to:cc :from:subject:date:mime-version:content-type:message-id; s= default; bh=cZ/bOmI2uAk8DkwkKYHHcF8EjQU=; b=adyXz7uAyh5TpVCmHL+a 5qm+nXgYfUtvqvCN4Isuft1QNhvU/4YPV+BnPywRCwlkSaMBysp7LJ8Dluw4u1vn OUMILZkCmbF5LLiNHx+Nh7ehnJHEj41Rvw9LuH28Nz67d3LTb2+CMX1XHyF9LcLu vDWH720SYGAABrCaTyiZITo= Received: (qmail 13400 invoked by alias); 11 Feb 2020 08:01:51 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 13392 invoked by uid 89); 11 Feb 2020 08:01:51 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-21.8 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.1 spammy= X-HELO: mx0a-001b2d01.pphosted.com Received: from mx0a-001b2d01.pphosted.com (HELO mx0a-001b2d01.pphosted.com) (148.163.156.1) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 11 Feb 2020 08:01:49 +0000 Received: from pps.filterd (m0098394.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 01B80I63078151 for ; Tue, 11 Feb 2020 03:01:48 -0500 Received: from e06smtp04.uk.ibm.com (e06smtp04.uk.ibm.com [195.75.94.100]) by mx0a-001b2d01.pphosted.com with ESMTP id 2y1ubrbwdc-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Tue, 11 Feb 2020 03:01:47 -0500 Received: from localhost by e06smtp04.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 11 Feb 2020 08:01:45 -0000 Received: from b06cxnps3074.portsmouth.uk.ibm.com (9.149.109.194) by e06smtp04.uk.ibm.com (192.168.101.134) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Tue, 11 Feb 2020 08:01:42 -0000 Received: from b06wcsmtp001.portsmouth.uk.ibm.com (b06wcsmtp001.portsmouth.uk.ibm.com [9.149.105.160]) by b06cxnps3074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 01B81fi91049036 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 11 Feb 2020 08:01:41 GMT Received: from b06wcsmtp001.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 4F3E0A4054; Tue, 11 Feb 2020 08:01:41 +0000 (GMT) Received: from b06wcsmtp001.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 104EAA4064; Tue, 11 Feb 2020 08:01:39 +0000 (GMT) Received: from KewenLins-MacBook-Pro.local (unknown [9.200.55.248]) by b06wcsmtp001.portsmouth.uk.ibm.com (Postfix) with ESMTP; Tue, 11 Feb 2020 08:01:38 +0000 (GMT) To: GCC Patches Cc: vmakarov@redhat.com, bergner@linux.ibm.com, zadeck@naturalbridge.com, Segher Boessenkool , Bill Schmidt From: "Kewen.Lin" Subject: [PATCH, IRA] Fix PR91052 by skipping multiple_sets insn in combine_and_move_insns Date: Tue, 11 Feb 2020 16:01:37 +0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:68.0) Gecko/20100101 Thunderbird/68.2.2 MIME-Version: 1.0 x-cbid: 20021108-0016-0000-0000-000002E5B640 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 20021108-0017-0000-0000-00003348AB11 Message-Id: <38965b1a-6827-6edd-a708-26d6d1a02e77@linux.ibm.com> X-IsSubscribed: yes Hi, As PR91052's comments show, commit r272731 exposed one issue in function combine_and_move_insns. Function combine_and_move_insns perform the below unexpected transformation. ** Before: ** 67: NOTE_INSN_BASIC_BLOCK 8 ... 59: {r184:SF=[sfp:SI-0x190];r121:SI=sfp:SI-0x190;} ==> move object REG_UNUSED r121:SI 77: {r191:SF=[sfp:SI-0x18c];r121:SI=sfp:SI-0x18c;} 60: r122:SI=r127:SI REG_DEAD r127:SI 61: [r122:SI]=r184:SF REG_DEAD r184:SF 79: [++r122:SI]=r191:SF REG_DEAD r191:SF REG_INC r122:SI 64: r187:SF=[r137:SI+low(`*.LC0')] 99: r198:SF=[++r121:SI] =====> with sp-0x18c+4; REG_INC r121:SI 104: r201:SF=[r137:SI+low(`*.LC0')] 65: [r126:SI]=r187:SF REG_DEAD r187:SF 105: [r126:SI]=r201:SF REG_DEAD r201:SF 101: [++r122:SI]=r198:SF REG_DEAD r198:SF REG_INC r122:SI 114: L114: 113: NOTE_INSN_BASIC_BLOCK 9 ** After: ** 67: NOTE_INSN_BASIC_BLOCK 8 ... 77: {r191:SF=[sfp:SI-0x18c];r121:SI=sfp:SI-0x18c;} REG_UNUSED r121:SI 60: r122:SI=r127:SI REG_DEAD r127:SI 219: {r184:SF=[sfp:SI-0x190];r121:SI=sfp:SI-0x190;} ==> moved here but update origin r121. 61: [r122:SI]=r184:SF REG_DEAD r184:SF 79: [++r122:SI]=r191:SF REG_DEAD r191:SF REG_INC r122:SI 64: r187:SF=[r137:SI+low(`*.LC0')] REG_EQUIV [r137:SI+low(`*.LC0')] 99: r198:SF=[++r121:SI] =====> with sp-0x18c; inconsistent from above. REG_INC r121:SI 104: r201:SF=[r137:SI+low(`*.LC0')] REG_EQUIV [r137:SI+low(`*.LC0')] 65: [r126:SI]=r187:SF REG_DEAD r187:SF 105: [r126:SI]=r201:SF REG_DEAD r201:SF 101: [++r122:SI]=r198:SF REG_DEAD r198:SF REG_INC r122:SI 114: L114: 113: NOTE_INSN_BASIC_BLOCK 9 The insn 59 is special with multiple_sets, its movement alters the live interval of r121 from insn 77 to insn 99 and update r121 with unexpected value. Bootstrapped/regtested on powerpc64le-linux-gnu (LE) and ppc64-redhat-linux (BE). Is it ok for trunk? BR, Kewen ------- gcc/ChangeLog 2020-02-11 Kewen Lin * ira.c (combine_and_move_insns): Skip multiple_sets def_insn. diff --git a/gcc/ira.c b/gcc/ira.c index c8b5f86..a655ae1 100644 --- a/gcc/ira.c +++ b/gcc/ira.c @@ -3784,6 +3784,11 @@ combine_and_move_insns (void) if (can_throw_internal (def_insn)) continue; + /* Instructions with multiple sets can only be moved if DF analysis is + performed for all of the registers set. See PR91052. */ + if (multiple_sets (def_insn)) + continue; + basic_block use_bb = BLOCK_FOR_INSN (use_insn); basic_block def_bb = BLOCK_FOR_INSN (def_insn); if (bb_loop_depth (use_bb) > bb_loop_depth (def_bb))