From patchwork Thu Sep 20 04:25:11 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joern Rennecke X-Patchwork-Id: 185306 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 2707A2C0094 for ; Thu, 20 Sep 2012 14:25:38 +1000 (EST) Comment: DKIM? See http://www.dkim.org DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=gcc.gnu.org; s=default; x=1348719940; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Received: Message-ID:Date:From:To:Cc:Subject:MIME-Version:Content-Type: Content-Transfer-Encoding:User-Agent:Mailing-List:Precedence: List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender: Delivered-To; bh=HCWdVX3jptnyAlBUHBmiLcQIUKE=; b=eAITkzBAS/XbIGJ IukVGsNB2Ue0weOGmWR6Mcgyjw/fYNv2xcYl7Vk6TNclwFeWznIv8+pUXDfgN9Lx XSZWxkts3fEjpPWaiokuyDOHIk7/nIalNxvV25sMt+Rv4agXeOjQ3ubMtdM7HkjP Y7F4KlgFT7tWH7Zh2doRdMwvEsLg= Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=gcc.gnu.org; h=Received:Received:X-SWARE-Spam-Status:X-Spam-Check-By:Received:Received:Received:Message-ID:Date:From:To:Cc:Subject:MIME-Version:Content-Type:Content-Transfer-Encoding:User-Agent:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=bKdUdLr90z+qoJ1G/j/qFk8RAqTe8vRONGqOlNMQQc19UHi9v7XeIbA1jGgYxb FNikKEWz5cO6hKBrK8d6Kdc3tcpSzKI+eyU3UFsSZEPz6Yf9v/0fnHDHpqT74Y/c eEASgmHOyrPzzvXAL+UU39V2HGPuYiZwC4BX/w1uOFydE=; Received: (qmail 28660 invoked by alias); 20 Sep 2012 04:25:31 -0000 Received: (qmail 28618 invoked by uid 22791); 20 Sep 2012 04:25:26 -0000 X-SWARE-Spam-Status: No, hits=-2.4 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from c62.cesmail.net (HELO c62.cesmail.net) (216.154.195.54) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 20 Sep 2012 04:25:13 +0000 Received: from unknown (HELO delta2) ([192.168.1.50]) by c62.cesmail.net with ESMTP; 20 Sep 2012 00:56:16 -0400 Received: from cust213-dsl91-135-11.idnet.net (cust213-dsl91-135-11.idnet.net [91.135.11.213]) by webmail.spamcop.net (Horde MIME library) with HTTP; Thu, 20 Sep 2012 00:25:11 -0400 Message-ID: <20120920002511.qoon4s1fggsw4gwo-nzlynne@webmail.spamcop.net> Date: Thu, 20 Sep 2012 00:25:11 -0400 From: Joern Rennecke To: gcc-patches@gcc.gnu.org Cc: rth@gcc.gnu.org Subject: RFA: Fix COND_EXEC handling of dead_or_set_regno_p MIME-Version: 1.0 User-Agent: Internet Messaging Program (IMP) H3 (4.1.4) 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 I've seen a number of execution failures with the soon-to-be submitted ARCompact port in the context of gcc 4.8, which where down to an rtlanal.c:dead_or_set_p problem, e.g.: gcc.c-torture/execute/builtin-bitops-1.c -O1 As the comment at the top of dead_or_set_p states, this function should return true if a register is dies in INSN or is entirely set. A COND_EXEC does not set at all if the condition is not true; for the purposes of dead_or_set_p, it should be treated like a partial set or a REG_INC, i.e. the COND_EXEC and its contents should be disregarded. Yet dead_or_set_regno_p, a helper function of dead_or_set_p, instead processes a COND_EXEC as if it always took place. I see this was introduced in the 2000-04-07 mega-patch that introduced COND_EXEC. Certainly in lots of other places the right thing is to look inside the COND_EXEC, but not here. Fixed with the attached patch. Bootstrapped on ia64-unknown-linux-gnu. 2011-11-27 Joern Rennecke * rtlanal.c (dead_or_set_regno_p): Fix COND_EXEC handling. Index: rtlanal.c =================================================================== --- rtlanal.c (revision 191467) +++ rtlanal.c (working copy) @@ -1701,8 +1701,9 @@ pattern = PATTERN (insn); + /* If a COND_EXEC is not executed, the value survives. */ if (GET_CODE (pattern) == COND_EXEC) - pattern = COND_EXEC_CODE (pattern); + return 0; if (GET_CODE (pattern) == SET) return covers_regno_p (SET_DEST (pattern), test_regno);