From patchwork Thu Oct 31 13:23:52 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Robert Suchanek X-Patchwork-Id: 287488 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 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id CC00C2C03DB for ; Fri, 1 Nov 2013 00:24:39 +1100 (EST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:subject:date:message-id:content-type :content-transfer-encoding:mime-version; q=dns; s=default; b=QQQ WEnULPgu0qfcNO2EFmZBopIyuMwzL2hFx3TnUA2IJepD9SmtSQAcCFL6iPkAk4iB AYMqawnh80zXcncZIPdP6pBmkruEcIxMvkR1d9e9fBSNT5juisgWQ04n1qXT951c ZoayKeVvES7T6658m9WlfdtRO5rNsQo+EKtsJ23A= 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:from :to:subject:date:message-id:content-type :content-transfer-encoding:mime-version; s=default; bh=SMfPPQxLs EQLnCaVE4OD3pWCm5M=; b=xn6xaAFOncdIsQq1RRQ0LHqKzwZAkR4hc4xeRQ1d8 mQ5FWUhjjB7flMmb+BDSawjdICbrz50a2L9xkk+niNpEMTQ+IkArhjalXbgev5uu IC2e8ZwMqKk0YkNgmoIdwx9pW3jEQxeu/iccFDX5cAN4O9gm90NKvPjH6ydNCQzQ F4= Received: (qmail 2869 invoked by alias); 31 Oct 2013 13:24:27 -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 2716 invoked by uid 89); 31 Oct 2013 13:24:25 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=0.1 required=5.0 tests=AWL, BAYES_00, RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: multi.imgtec.com Received: from multi.imgtec.com (HELO multi.imgtec.com) (194.200.65.239) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA encrypted) ESMTPS; Thu, 31 Oct 2013 13:24:25 +0000 From: Robert Suchanek To: "gcc-patches@gcc.gnu.org" Subject: [PATCH] LRA: Fix incorrect register spill/reload Date: Thu, 31 Oct 2013 13:23:52 +0000 Message-ID: MIME-Version: 1.0 X-SEF-Processed: 7_3_0_01192__2013_10_31_13_24_22 Hello, When investigating regression with LRA enabled for mips16 I found incorrect spilling and reload of registers by callee.  In the case, one register was not saved, although used, and another one never used but saved/restored. The issue appears to be in setting registers ever lived and subsequent passes save/restore the wrong register(s). I have attached a patch below. I presume that the statement terminator was typed accidentally as I do not see a justification of the df_set_regs_ever_live() function to be outside the for loop. Or I am wrong? Regards, Robert     * lra-spills.c (assign_spill_hard_regs): Removed statement terminator after comment.     Loop body outside the for loop. diff --git a/gcc/lra-spills.c b/gcc/lra-spills.c index 7c0c630..e1cf654 100644 --- a/gcc/lra-spills.c +++ b/gcc/lra-spills.c @@ -334,8 +334,8 @@ assign_spill_hard_regs (int *pseudo_regnos, int n)        for (nr = 0;            nr < hard_regno_nregs[hard_regno][lra_reg_info[regno].biggest_mode];            nr++) -       /* Just loop.  */; -      df_set_regs_ever_live (hard_regno + nr, true); +       /* Just loop.  */ +        df_set_regs_ever_live (hard_regno + nr, true);      }    bitmap_clear (&ok_insn_bitmap);    free (reserved_hard_regs);