From patchwork Mon May 2 13:20:52 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernd Schmidt X-Patchwork-Id: 617539 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 3qz4gl2mJJz9t3V for ; Mon, 2 May 2016 23:21:05 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=VQSRHqfx; 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 :subject:to:references:cc:from:message-id:date:mime-version :in-reply-to:content-type; q=dns; s=default; b=loi6foy1b4YNA385w lk0OBnT2xxVXKv23TNSOs9mqTVy7FCWNX61jWpKItpw456jr/ICCLP3Kh6dI/5ft Jbe1+Iwo3yVXuWU5HbCR7innE+riTbYRe2+8M/7M5fCHwec6ij/jDkvmRmcMj491 2eYmM1CttD+c2fhYbORXnnVTac= 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 :subject:to:references:cc:from:message-id:date:mime-version :in-reply-to:content-type; s=default; bh=S8CncExnwfkTbGVVDlBWBVr g3zk=; b=VQSRHqfxNe1obr9UC1yrRD+B0MSLRvbPfHkKpNELaik4fD6GgGCKrFx 7pXHvnKS0/IkHw4xOZv2EjnLB/uWRELD//+PVaQQlN58qzgJMt6vkONduPSucG0v hMFvRrdLdBZnKVeoby9Ps5YoohgS6dJwb4qIr2wj+VjnonolUFnQ= Received: (qmail 58605 invoked by alias); 2 May 2016 13:20:58 -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 58555 invoked by uid 89); 2 May 2016 13:20:57 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.9 required=5.0 tests=BAYES_00, RP_MATCHES_RCVD, SPF_HELO_PASS autolearn=ham version=3.3.2 spammy= X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Mon, 02 May 2016 13:20:56 +0000 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 003C7C04B31C; Mon, 2 May 2016 13:20:54 +0000 (UTC) Received: from localhost.localdomain (vpn1-6-119.ams2.redhat.com [10.36.6.119]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u42DKqKS011090; Mon, 2 May 2016 09:20:53 -0400 Subject: Re: Enabling -frename-registers? To: Uros Bizjak References: <572736E2.4040506@redhat.com> Cc: "gcc-patches@gcc.gnu.org" , Jeff Law From: Bernd Schmidt Message-ID: <57275434.5080003@redhat.com> Date: Mon, 2 May 2016 15:20:52 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.6.0 MIME-Version: 1.0 In-Reply-To: X-IsSubscribed: yes On 05/02/2016 01:57 PM, Uros Bizjak wrote: > With the referred testcase, the compare-debug failure trips on (debug_insn 101) Ok, INDEX_REG_CLASS is NO_REGS on alpha, and apparently the contents of the MEM isn't a valid address. Try this? Bernd Index: gcc/regrename.c =================================================================== --- gcc/regrename.c (revision 235753) +++ gcc/regrename.c (working copy) @@ -1238,6 +1238,19 @@ scan_rtx_reg (rtx_insn *insn, rtx *loc, } } +/* A wrapper around base_reg_class which returns ALL_REGS if INSN is a + DEBUG_INSN. The arguments MODE, AS, CODE and INDEX_CODE are as for + base_reg_class. */ + +static reg_class +base_reg_class_for_rename (rtx_insn *insn, machine_mode mode, addr_space_t as, + rtx_code code, rtx_code index_code) +{ + if (DEBUG_INSN_P (insn)) + return ALL_REGS; + return base_reg_class (mode, as, code, index_code); +} + /* Adapted from find_reloads_address_1. CL is INDEX_REG_CLASS or BASE_REG_CLASS depending on how the register is being considered. */ @@ -1343,12 +1356,16 @@ scan_rtx_address (rtx_insn *insn, rtx *l } if (locI) - scan_rtx_address (insn, locI, INDEX_REG_CLASS, action, mode, as); + { + reg_class iclass = DEBUG_INSN_P (insn) ? ALL_REGS : INDEX_REG_CLASS; + scan_rtx_address (insn, locI, iclass, action, mode, as); + } if (locB) - scan_rtx_address (insn, locB, - base_reg_class (mode, as, PLUS, index_code), - action, mode, as); - + { + reg_class bclass = base_reg_class_for_rename (insn, mode, as, PLUS, + index_code); + scan_rtx_address (insn, locB, bclass, action, mode, as); + } return; } @@ -1366,10 +1383,13 @@ scan_rtx_address (rtx_insn *insn, rtx *l break; case MEM: - scan_rtx_address (insn, &XEXP (x, 0), - base_reg_class (GET_MODE (x), MEM_ADDR_SPACE (x), - MEM, SCRATCH), - action, GET_MODE (x), MEM_ADDR_SPACE (x)); + { + reg_class bclass = base_reg_class_for_rename (insn, GET_MODE (x), + MEM_ADDR_SPACE (x), + MEM, SCRATCH); + scan_rtx_address (insn, &XEXP (x, 0), bclass, action, GET_MODE (x), + MEM_ADDR_SPACE (x)); + } return; case REG: @@ -1416,10 +1436,14 @@ scan_rtx (rtx_insn *insn, rtx *loc, enum return; case MEM: - scan_rtx_address (insn, &XEXP (x, 0), - base_reg_class (GET_MODE (x), MEM_ADDR_SPACE (x), - MEM, SCRATCH), - action, GET_MODE (x), MEM_ADDR_SPACE (x)); + { + reg_class bclass = base_reg_class_for_rename (insn, GET_MODE (x), + MEM_ADDR_SPACE (x), + MEM, SCRATCH); + + scan_rtx_address (insn, &XEXP (x, 0), bclass, action, GET_MODE (x), + MEM_ADDR_SPACE (x)); + } return; case SET: