From patchwork Mon Mar 6 08:27:37 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Xi Ruoyao X-Patchwork-Id: 735626 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org 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 3vcCbV2FJTz9s88 for ; Mon, 6 Mar 2017 19:28:04 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="lrTYK3fH"; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :message-id:subject:from:to:cc:date:content-type:mime-version :content-transfer-encoding; q=dns; s=default; b=ySO2LMajdqaeItr1 VoCjrIIDDNMmo8BhGwQzS3YomJwyDvXCFrSKw4aDQHeh+yt24ap8V0xEkKqWwxjE 68pFHQlNtlxHlnS+sPhO5KjJ9TNfj0K5PqbWZBBApTfNcRGNKS6WnfY7mdUKMGdA Al8mSsLUSboKigJQbHObSYFhU0c= 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 :message-id:subject:from:to:cc:date:content-type:mime-version :content-transfer-encoding; s=default; bh=Di9wTjjoEEEzH0jMI1IsWH xeEJo=; b=lrTYK3fHCd1czjMyxIltWR7zqQ4C3Z35zl/GUxWITKCAkF1Ppm5gMn VNsqcg+SfQZvc52TsLzp8hkbUyWjNjdi6v4VSSKxy/ETBYv4xLiS39sjzuaOqmZT xb7OVrdRJL/l8BhOCZSQblvICYofC5S5BPFIWrPXAdMHMxWq3BfiU= Received: (qmail 18313 invoked by alias); 6 Mar 2017 08:27: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 18287 invoked by uid 89); 6 Mar 2017 08:27:49 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-24.3 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_LAZY_DOMAIN_SECURITY, RP_MATCHES_RCVD, URIBL_SBL autolearn=ham version=3.3.2 spammy=H*Ad:D*edu.cn, H*Ad:D*cn, HCc:D*cn, Hx-languages-length:1768 X-HELO: stu.xidian.edu.cn Received: from stumail.xidian.edu.cn (HELO stu.xidian.edu.cn) (202.117.112.40) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with SMTP; Mon, 06 Mar 2017 08:27:47 +0000 Received: from xry111-laptop (xry111-laptop [10.170.37.151]) by stu.xidian.edu.cn (eYou MTA v8.1.0) with ESMTP id 241eceeb3a6f5bf8e59f816fa3cd688e for ; Mon, 06 Mar 2017 16:37:55 +0800 X-Eyou-Smtpauth: ryxi@stu.xidian.edu.cn Message-ID: <1488788857.963.12.camel@stu.xidian.edu.cn> Subject: [PATCH] Use fixed_nonglobal_reg_set to deduce ok_regs (PR rtl-optimization/79728) From: Xi Ruoyao To: David Binderman , Martin =?UTF-8?Q?Li=C5=A1ka?= , Bernd Schmidt Cc: Xi Ruoyao , gcc-patches@gcc.gnu.org Date: Mon, 06 Mar 2017 16:27:37 +0800 Mime-Version: 1.0 X-Eyou-Sender: Hi, After Bernd fixed PR44281 (r235809), the registers fixed only because they are global can be selected by IRA. However, since they are not in ok_regs, the move cost estimation about them are wrong. Then an assertion in ira.c failed and then ICE. To fix this, add these registers into ok_regs. Bootstrapped/regtested on x86_64-linux-gnu. Is this ok for trunk? 2017-03-06  Xi Ruoyao   PR rtl-optimization/79728 * reginfo.c (init_reg_sets_1): Use fixed_nonglobal_reg_set (instead of fixed_regs) to deduce ok_regs. * gcc.target/i386/pr79728.c: New test. diff --git a/gcc/reginfo.c b/gcc/reginfo.c index a2e0b68..85e2695 100644 --- a/gcc/reginfo.c +++ b/gcc/reginfo.c @@ -471,7 +471,8 @@ init_reg_sets_1 (void)        HARD_REG_SET ok_regs;        CLEAR_HARD_REG_SET (ok_regs);        for (j = 0; j < FIRST_PSEUDO_REGISTER; j++) - if (!fixed_regs [j] && HARD_REGNO_MODE_OK (j, (machine_mode) m)) + if (!TEST_HARD_REG_BIT (fixed_nonglobal_reg_set, j) && +     HARD_REGNO_MODE_OK (j, (machine_mode) m))     SET_HARD_REG_BIT (ok_regs, j);          for (i = 0; i < N_REG_CLASSES; i++) diff --git a/gcc/testsuite/gcc.target/i386/pr79728.c b/gcc/testsuite/gcc.target/i386/pr79728.c new file mode 100644 index 0000000..2f3dede --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr79728.c @@ -0,0 +1,11 @@ +/* Test for ICE with global register variable assigned to +   xmm0.  PR79728.  */ +/* { dg-do compile } */ +/* { dg-options "-w -msse" } */ + +register int a __asm__ ("xmm0"); + +int foo () +{ +  return 0; +}