From patchwork Wed Apr 10 20:15:09 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Makarov X-Patchwork-Id: 235466 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 CN "localhost", Issuer "www.qmailtoaster.com" (not verified)) by ozlabs.org (Postfix) with ESMTPS id 077ED2C009E for ; Thu, 11 Apr 2013 06:15:41 +1000 (EST) 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:date:from:mime-version:to:subject:content-type; q= dns; s=default; b=tC7LUYeoaY8cV4bGcx093beZDUDD+afkNGNOwvDrfIVKBV bO8C8SGP5+w1AwLstp4+4Cu+Y9mKFnZroGA2IMbgVgT/M53mSrrsTmdKPBeYHzW9 b6QAgATQ+HaG2sYMXGOStlz0Kmlv6AOqrnB27g9UGZP7d6WQvG3fR1dlpKN/o= 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:date:from:mime-version:to:subject:content-type; s= default; bh=HVl5gTmpK7iQ7Td/DtUYa0+xN7c=; b=GKpQwoGeRO1v8oqQwMKP EDphFrZY40tkzrDbtc3Js9HRjzB3mmS81BUk/GEvOVneuPyM4V2LTMwmTUOYLUqq 0YTYLA8aIyqUA0tQYyI0G+6VlOvcIaaswOwkV7qxjUM8p0vXicbGv7wuCwohxpRF 0QuQogLq0pqSwIOK8pvidbY= Received: (qmail 21368 invoked by alias); 10 Apr 2013 20:15:15 -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 21092 invoked by uid 89); 10 Apr 2013 20:15:13 -0000 X-Spam-SWARE-Status: No, score=-7.7 required=5.0 tests=AWL, BAYES_00, KHOP_RCVD_UNTRUST, RCVD_IN_DNSWL_HI, RCVD_IN_HOSTKARMA_W, RP_MATCHES_RCVD, SPF_HELO_PASS autolearn=ham version=3.3.1 Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Wed, 10 Apr 2013 20:15:13 +0000 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r3AKFABH002699 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Wed, 10 Apr 2013 16:15:11 -0400 Received: from Mair.local (vpn-56-51.rdu2.redhat.com [10.10.56.51]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id r3AKF903011577; Wed, 10 Apr 2013 16:15:10 -0400 Message-ID: <5165C84D.3090608@redhat.com> Date: Wed, 10 Apr 2013 16:15:09 -0400 From: Vladimir Makarov User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:17.0) Gecko/20130328 Thunderbird/17.0.5 MIME-Version: 1.0 To: GCC Patches , Uros Bizjak Subject: [RFA] patch to fix PR56903 X-Virus-Found: No The following patch fixes http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56903 In this test case reload pass gets correct value HARD_REGNO_MODE_OK because it can not create pseudos (can_create_pseudo) and this was actually used that we are in reload (or after reload). LRA can create pseudos therefore it got the wrong answer. The patch fixes it. OK for the trunk? 2013-04-10 Vladimir Makarov PR tree-optimization/56903 * config/i386/i386.c (ix86_hard_regno_mode_ok): Add lra_in_progress for return. 2013-04-10 Vladimir Makarov PR tree-optimization/56903 * gcc.target/i386/pr56903.c: New test. Index: config/i386/i386.c =================================================================== --- config/i386/i386.c (revision 197679) +++ config/i386/i386.c (working copy) @@ -33976,7 +33976,9 @@ ix86_hard_regno_mode_ok (int regno, enum return true; if (!TARGET_PARTIAL_REG_STALL) return true; - return !can_create_pseudo_p (); + /* LRA can create pseudos but it does not mean that it does not + need to know that the hard register in given mode is OK. */ + return lra_in_progress || !can_create_pseudo_p (); } /* We handle both integer and floats in the general purpose registers. */ else if (VALID_INT_MODE_P (mode)) Index: testsuite/gcc.target/i386/pr56903.c =================================================================== --- testsuite/gcc.target/i386/pr56903.c (revision 0) +++ testsuite/gcc.target/i386/pr56903.c (working copy) @@ -0,0 +1,18 @@ +/* PR rtl-optimization/56903 */ +/* { dg-do compile } */ +/* { dg-options "-Os" } */ +/* { dg-additional-options "-march=pentium3" { target ia32 } } */ + +int a, *b, c; +struct S { int s : 1; } *fn1 (void); +extern int fn3 (void), fn4 (int *); + +void +fn2 (void) +{ + int e = fn3 (); + char f = c + fn1 ()->s * 4; + if (*b && f == e) + a = *b; + fn4 (b); +}