From patchwork Fri May 3 13:10:19 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julian Brown X-Patchwork-Id: 241309 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 03E272C00D3 for ; Fri, 3 May 2013 23:10:42 +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:date :from:to:cc:subject:message-id:mime-version:content-type; q=dns; s=default; b=OYfRUJvGJdoLSqXYFalSGaS55aigtWn2+Uv4fIXZG/GGUVos7Q VpKoagfcngHHixUnF/ZxcJnyj66mA+ECG+rU2oFAQ4nOeujlPUs5e14JXfGP6c6m qTXoyMUSVJdLAWRXw5iKSRD5WvlWm97di31Fbr2nCBBeNZqdnQ0E/fdzg= 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:date :from:to:cc:subject:message-id:mime-version:content-type; s= default; bh=KnMFOMeApwnNV+EYDYnj2rsPBuk=; b=Z0jEDhO2Rq4Hu1TCpT41 B0dpSMybPvVj/nJF3PHZrAtwUXIHtu8SEvDX/ZlEoGh4fGEBv/UPGTcqvsEXE4cr OJIHLtbLWjoPWhVdSatE6jzFYeF0eu2fNQ7hEHuGHnD9h0oXU90Vq76eylsoBKIc TK4padzrkiFS3Qm0HKeSjaU= Received: (qmail 24542 invoked by alias); 3 May 2013 13:10:36 -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 24506 invoked by uid 89); 3 May 2013 13:10:31 -0000 X-Spam-SWARE-Status: No, score=-3.6 required=5.0 tests=AWL, BAYES_00, FROM_12LTRDOM, KHOP_RCVD_UNTRUST, RCVD_IN_HOSTKARMA_W, RCVD_IN_HOSTKARMA_WL autolearn=no version=3.3.1 Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Fri, 03 May 2013 13:10:31 +0000 Received: from svr-orw-exc-10.mgc.mentorg.com ([147.34.98.58]) by relay1.mentorg.com with esmtp id 1UYFkq-0006rI-Or from Julian_Brown@mentor.com ; Fri, 03 May 2013 06:10:28 -0700 Received: from SVR-IES-FEM-01.mgc.mentorg.com ([137.202.0.104]) by SVR-ORW-EXC-10.mgc.mentorg.com with Microsoft SMTPSVC(6.0.3790.4675); Fri, 3 May 2013 06:10:28 -0700 Received: from octopus (137.202.0.76) by SVR-IES-FEM-01.mgc.mentorg.com (137.202.0.104) with Microsoft SMTP Server id 14.2.247.3; Fri, 3 May 2013 14:10:26 +0100 Date: Fri, 3 May 2013 14:10:19 +0100 From: Julian Brown To: CC: Steven Bosscher Subject: [PATCH] Fix latent bug in RTL GCSE/PRE (PR57159) Message-ID: <20130503141019.391ca3f4@octopus> MIME-Version: 1.0 X-Virus-Found: No Hi, This is a patch which fixes a latent bug in RTL GCSE/PRE, described more fully in: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57159 I haven't been able to reproduce the problem on mainline (nor on a supported target). Maybe someone more familiar with the code in question than I am can tell if the patch is correct nonetheless? Thanks, Julian ChangeLog gcc/ * gcse.c (compute_ld_motion_mems): Invalidate non-simple mem refs in REG_EQUAL notes. Index: gcc/gcse.c =================================================================== --- gcc/gcse.c (revision 198175) +++ gcc/gcse.c (working copy) @@ -3888,6 +3888,13 @@ compute_ld_motion_mems (void) { rtx src = SET_SRC (PATTERN (insn)); rtx dest = SET_DEST (PATTERN (insn)); + rtx note = find_reg_equal_equiv_note (insn); + rtx src_eq; + + if (note != 0 && REG_NOTE_KIND (note) == REG_EQUAL) + src_eq = XEXP (note, 0); + else + src_eq = NULL_RTX; /* Check for a simple LOAD... */ if (MEM_P (src) && simple_mem (src)) @@ -3904,6 +3911,12 @@ compute_ld_motion_mems (void) invalidate_any_buried_refs (src); } + /* Also invalidate any buried loads which may be present in + REG_EQUAL notes. */ + if (src_eq != NULL_RTX + && !(MEM_P (src_eq) && simple_mem (src_eq))) + invalidate_any_buried_refs (src_eq); + /* Check for stores. Don't worry about aliased ones, they will block any movement we might do later. We only care about this exact pattern since those are the only