From patchwork Fri Sep 6 10:20:29 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joern Rennecke X-Patchwork-Id: 273135 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 "www.sourceware.org", Issuer "StartCom Class 1 Primary Intermediate Server CA" (not verified)) by ozlabs.org (Postfix) with ESMTPS id 96C002C00F2 for ; Fri, 6 Sep 2013 20:20:40 +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:to:cc:subject:mime-version:content-type :content-transfer-encoding; q=dns; s=default; b=gfhsxJxeK/N1/2jH zM6CI7Mr+MvPO25g4V60eGVeQuqZWbiSGT0EfGEy7pH5aBF675FdlHcDU1xp8HPT c4FRiJtUuQJzs0O5fuh2CcKFAZwXfF/W5orL70tAtVg7NlktvSn0KUNjP9GoNh3c pwcoQu9ZILDwfRcn4J+xm4dePU0= 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:to:cc:subject:mime-version:content-type :content-transfer-encoding; s=default; bh=WwDvPWCVoZszfIIscqdlKq g1DNk=; b=nWsDyBC05zuELQ0YCm8+8X747Dca1mqeUBCeNmNYl2drNMGzxB2WdV Hc6R5tnNUQsJ7f0SHe2IiBxKJ+2MB7tzbwjp6O9741b4O7jCxKNolMhU1+TxEqsa lIsjn4Pta5+x8J1m7qkCf8Iw4AF2BXxGD2frIr8DjjXEP6WdgKJeQ= Received: (qmail 27312 invoked by alias); 6 Sep 2013 10:20:33 -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 27298 invoked by uid 89); 6 Sep 2013 10:20:33 -0000 Received: from c62.cesmail.net (HELO c62.cesmail.net) (216.154.195.54) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA encrypted) ESMTPS; Fri, 06 Sep 2013 10:20:33 +0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.2 required=5.0 tests=AWL, BAYES_50, FSL_HELO_NON_FQDN_1, RDNS_NONE autolearn=no version=3.3.2 X-HELO: c62.cesmail.net Received: from unknown (HELO epsilon2) ([192.168.1.60]) by c62.cesmail.net with ESMTP; 06 Sep 2013 06:20:29 -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; Fri, 06 Sep 2013 06:20:29 -0400 Message-ID: <20130906062029.kleaivsw00ggow8c-nzlynne@webmail.spamcop.net> Date: Fri, 06 Sep 2013 06:20:29 -0400 From: Joern Rennecke To: gcc-patches@gcc.gnu.org Cc: Jeff Law Subject: RFA: Fix mark_target_live_regs to take COND_EXEC into account MIME-Version: 1.0 User-Agent: Internet Messaging Program (IMP) H3 (4.1.4) We found that std::basic_string, std::allocator ::copy(char*, unsigned long, unsigned long) const got miscompiled for ARC because reorg thought that all call-clobbered registers were dead after a conditional call. I can't reproduce the test case with current trunk + ARC port, but I reckon this is just due to the fickleness of the register allocator. Chances are, every other version, some other obscure function is miscompiled without this patch. bootstrapped on i686-pc-linux-gnu. OK to apply? 2013-04-29 Claudiu Zissulescu * resource.c (mark_target_live_regs): Compute resources taking into account if a call is predicated or not. diff --git a/gcc/resource.c b/gcc/resource.c Index: resource.c =================================================================== --- resource.c (revision 202295) +++ resource.c (working copy) @@ -994,11 +994,18 @@ mark_target_live_regs (rtx insns, rtx ta if (CALL_P (real_insn)) { - /* CALL clobbers all call-used regs that aren't fixed except - sp, ap, and fp. Do this before setting the result of the - call live. */ - AND_COMPL_HARD_REG_SET (current_live_regs, - regs_invalidated_by_call); + /* Values in call-clobbered registers survive a COND_EXEC CALL + if that is not executed; this matters for resoure use because + they may be used by a complementarily (or more strictly) + predicated instruction, or if the CALL is NORETURN. */ + if (GET_CODE (PATTERN (real_insn)) != COND_EXEC) + { + /* CALL clobbers all call-used regs that aren't fixed except + sp, ap, and fp. Do this before setting the result of the + call live. */ + AND_COMPL_HARD_REG_SET (current_live_regs, + regs_invalidated_by_call); + } /* A CALL_INSN sets any global register live, since it may have been modified by the call. */