From patchwork Sat Jun 4 12:50:38 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Alexandre Oliva X-Patchwork-Id: 98725 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 35898B6FCA for ; Sat, 4 Jun 2011 22:55:39 +1000 (EST) Received: (qmail 10720 invoked by alias); 4 Jun 2011 12:55:38 -0000 Received: (qmail 10712 invoked by uid 22791); 4 Jun 2011 12:55:37 -0000 X-SWARE-Spam-Status: No, hits=-5.8 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_HI, SPF_HELO_PASS, TW_CF, T_RP_MATCHES_RCVD, T_TVD_MIME_NO_HEADERS X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sat, 04 Jun 2011 12:55:24 +0000 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p54CtNeG000477 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Sat, 4 Jun 2011 08:55:23 -0400 Received: from freie.oliva.athome.lsd.ic.unicamp.br (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id p54CtKBs021542 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Sat, 4 Jun 2011 08:55:23 -0400 Received: from livre.localdomain (livre-to-gw.oliva.athome.lsd.ic.unicamp.br [172.31.160.19]) by freie.oliva.athome.lsd.ic.unicamp.br (8.14.4/8.14.4) with ESMTP id p54CtGed023630 for ; Sat, 4 Jun 2011 09:55:19 -0300 Received: from livre.localdomain (aoliva@localhost.localdomain [127.0.0.1]) by livre.localdomain (8.14.3/8.14.3/Debian-5+lenny1) with ESMTP id p54CogsW007455; Sat, 4 Jun 2011 09:50:42 -0300 Received: (from aoliva@localhost) by livre.localdomain (8.14.3/8.14.3/Submit) id p54Coetp007453; Sat, 4 Jun 2011 09:50:40 -0300 From: Alexandre Oliva To: gcc-patches@gcc.gnu.org Subject: fix latent compare-debug problem in cprop Date: Sat, 04 Jun 2011 09:50:38 -0300 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) MIME-Version: 1.0 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 If cprop regards changes to debug insns as “changed”, it will perform cfg optimizations and more, even if no non-debug insns were changed, causing divergence between -g and -g0 compilations. This was observed during bootstrap-debug-lib of the SSA coalesce patch, building a-strsea.adb with -fcompare-debug. Because of different CFGs, cse2 chose different equivalent pseudos for an insn. -fcompare-debug detected the difference in REG notes, even though the executable code turned out to be the same. We can't count on this luck, though: other optimization passes could apply different transformations to the different CFGs, producing different executable code, which must never happen. This patch fixes the problem, disregarding changes to debug insns as “changed”. Regstrapped on x86_64-linux-gnu and i686-linux-gnu. Ok to install? for gcc/ChangeLog from Alexandre Oliva * cprop.c (local_cprop_pass): Don't set changed for debug insns. Index: gcc/cprop.c =================================================================== --- gcc/cprop.c.orig 2011-06-04 05:09:24.414816329 -0300 +++ gcc/cprop.c 2011-06-04 05:09:25.954797626 -0300 @@ -1223,7 +1223,8 @@ local_cprop_pass (void) { if (do_local_cprop (reg_use_table[i], insn)) { - changed = true; + if (!DEBUG_INSN_P (insn)) + changed = true; break; } }