From patchwork Fri Nov 16 19:15:19 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Bergner X-Patchwork-Id: 999115 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-490327-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.b="OnGWRT8X"; 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 42xSdB5tZYz9s9m for ; Sat, 17 Nov 2018 06:16:11 +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 :content-transfer-encoding:message-id; q=dns; s=default; b=cCYqk NAId/yHcvFevkjYhRcgGCfI7pdmZKknhO9Cr5HvU9MolLWUUpmtrpSu+FiyrSATc BnjlTYF0dEjhRfw0lmSLYMVPN/Hf3BfxyZAppbxz5ZdF09JROMDUQMb/y6nq8iwI o2fpVWbOHnkrj5NheC5ULrq2+PK3NtXr1j1jJw= 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 :content-transfer-encoding:message-id; s=default; bh=cgluwA/doLT ZIsTCWA8ip9EJEqE=; b=OnGWRT8XnWSnos1lDuQZ5SsTp2iJPIpgQElbrPFePI9 vOl2DnWgXMgtJAP2DvkBEmGMMc/LrTkpr0W4K3ZTLcf4zeC2I4h/qzv62VnmoK2T yXV1XfSjGhkuaef8CWmifzmILLlEPOoQkExT6BUORUIZDOay0OiSsiAZVH2cbUG0 = Received: (qmail 27621 invoked by alias); 16 Nov 2018 19:16:04 -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 27407 invoked by uid 89); 16 Nov 2018 19:15:44 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-11.2 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_2, GIT_PATCH_3, KAM_ASCII_DIVIDERS, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 spammy=bootstrapping 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; Fri, 16 Nov 2018 19:15:41 +0000 Received: from pps.filterd (m0098394.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id wAGJE02B106235 for ; Fri, 16 Nov 2018 14:15:24 -0500 Received: from e33.co.us.ibm.com (e33.co.us.ibm.com [32.97.110.151]) by mx0a-001b2d01.pphosted.com with ESMTP id 2nt38yscrp-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Fri, 16 Nov 2018 14:15:24 -0500 Received: from localhost by e33.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 16 Nov 2018 19:15:23 -0000 Received: from b03cxnp08027.gho.boulder.ibm.com (9.17.130.19) by e33.co.us.ibm.com (192.168.1.133) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Fri, 16 Nov 2018 19:15:21 -0000 Received: from b03ledav001.gho.boulder.ibm.com (b03ledav001.gho.boulder.ibm.com [9.17.130.232]) by b03cxnp08027.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id wAGJFKkM27787468 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Fri, 16 Nov 2018 19:15:20 GMT Received: from b03ledav001.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id A7AAA6E050; Fri, 16 Nov 2018 19:15:20 +0000 (GMT) Received: from b03ledav001.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id F40606E04E; Fri, 16 Nov 2018 19:15:19 +0000 (GMT) Received: from otta.local (unknown [9.80.218.223]) by b03ledav001.gho.boulder.ibm.com (Postfix) with ESMTP; Fri, 16 Nov 2018 19:15:19 +0000 (GMT) To: Vladimir N Makarov , Jeff Law Cc: GCC Patches From: Peter Bergner Subject: [PATCH][LRA] Fix PR88033: ICE in remove_some_program_points_and_update_live_ranges Date: Fri, 16 Nov 2018 13:15:19 -0600 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 x-cbid: 18111619-0036-0000-0000-00000A5C3EF8 X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00010063; HX=3.00000242; KW=3.00000007; PH=3.00000004; SC=3.00000270; SDB=6.01118399; UDB=6.00580167; IPR=6.00898508; MB=3.00024196; MTD=3.00000008; XFM=3.00000015; UTC=2018-11-16 19:15:22 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18111619-0037-0000-0000-000049A8835B Message-Id: X-IsSubscribed: yes PR88033 shows a problem when handling simple copies from a register to itself: (insn (set (reg:DI NNN) (reg:DI NNN))) This was causing confusion in the code that performs liveness and conflict updates and program point updates in lra-lives.c. Trying to handle these types of copies would add some ugly code. It's easier to just bail on them in non_conflicting_reg_copy_p() altogether, since by definition, a register does not conflict with itself and so needs no special handling. The patch below implements that and fixes the ICE. This is currently bootstrapping and regtesting on x86_64-linux. Ok for mainline assuming the tests show no regressions? Peter gcc/ PR rtl-optimization/88033 * ira-lives.c (non_conflicting_reg_copy_p): Skip copies from a register to itself. Use HARD_REGISTER_NUM_P. gcc/testsuite/ PR rtl-optimization/88033 * gcc.target/i386/pr88033.c: New test. Index: gcc/ira-lives.c =================================================================== --- gcc/ira-lives.c (revision 266207) +++ gcc/ira-lives.c (working copy) @@ -1083,11 +1083,17 @@ non_conflicting_reg_copy_p (rtx_insn *insn) int src_regno = REGNO (SET_SRC (set)); machine_mode mode = GET_MODE (SET_DEST (set)); + /* By definition, a register does not conflict with itself, therefore we + do not have to handle it specially. Returning NULL_RTX now, helps + simplify the callers of this function. */ + if (dst_regno == src_regno) + return NULL_RTX; + /* Computing conflicts for register pairs is difficult to get right, so for now, disallow it. */ - if ((dst_regno < FIRST_PSEUDO_REGISTER + if ((HARD_REGISTER_NUM_P (dst_regno) && hard_regno_nregs (dst_regno, mode) != 1) - || (src_regno < FIRST_PSEUDO_REGISTER + || (HARD_REGISTER_NUM_P (src_regno) && hard_regno_nregs (src_regno, mode) != 1)) return NULL_RTX; Index: gcc/testsuite/gcc.target/i386/pr88033.c =================================================================== --- gcc/testsuite/gcc.target/i386/pr88033.c (nonexistent) +++ gcc/testsuite/gcc.target/i386/pr88033.c (working copy) @@ -0,0 +1,14 @@ +/* { dg-do compile } */ +/* { dg-options "-O2" } */ + +int +main (long a, long *b, long c) +{ + if (!c) + return 0; + int g; + *b = (g & ~3000000000) < 0 ? a : a - g; + while (1) + ; + return 0; +}