From patchwork Thu Jul 28 09:40:10 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Paulo J. Matos" X-Patchwork-Id: 107219 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]) by ozlabs.org (Postfix) with SMTP id ED12FB6F64 for ; Thu, 28 Jul 2011 19:40:54 +1000 (EST) Received: (qmail 23520 invoked by alias); 28 Jul 2011 09:40:45 -0000 Received: (qmail 23423 invoked by uid 22791); 28 Jul 2011 09:40:43 -0000 X-SWARE-Spam-Status: No, hits=-1.5 required=5.0 tests=AWL, BAYES_00, RCVD_NUMERIC_HELO, RP_MATCHES_RCVD, SPF_HELO_PASS X-Spam-Check-By: sourceware.org Received: from lo.gmane.org (HELO lo.gmane.org) (80.91.229.12) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 28 Jul 2011 09:40:26 +0000 Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1QmN4p-0000ky-34 for gcc-patches@gcc.gnu.org; Thu, 28 Jul 2011 11:40:23 +0200 Received: from 193.128.72.68 ([193.128.72.68]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 28 Jul 2011 11:40:23 +0200 Received: from paulo by 193.128.72.68 with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 28 Jul 2011 11:40:23 +0200 To: gcc-patches@gcc.gnu.org From: "Paulo J. Matos" Subject: [PATCH] PR rtl-optimization/49884: get_last_value checks register mode before returning value Date: Thu, 28 Jul 2011 10:40:10 +0100 Lines: 46 Message-ID: Mime-Version: 1.0 User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.18) Gecko/20110617 Thunderbird/3.1.11 X-IsSubscribed: yes 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 Hello, This is an attempt to fix 49884. get_last_value checks the register mode before returning any value. If the register was set using a different mode than the one we are currently inquiring about then we avoid making a wrong guess about the current value and return 0. PMatos 2011-07-28 Paulo J. Matos PR rtl-optimization/49884 * combine.c (get_last_value): For registers whose value was set using a different mode than the one we are currently inquiring about we return 0. diff --git a/gcc/combine.c b/gcc/combine.c index 4dbf022..5885f2a 100644 --- a/gcc/combine.c +++ b/gcc/combine.c @@ -12746,6 +12746,11 @@ get_last_value (const_rtx x) && DF_INSN_LUID (rsp->last_set) >= subst_low_luid) return 0; + /* If the value was set to the register when this was using a different mode + then we can't use it. */ + if(rsp->last_set_mode != GET_MODE(x)) + return 0; + /* If the value has all its registers valid, return it. */ if (get_last_value_validate (&value, rsp->last_set, rsp->last_set_label, 0)) return value;