From patchwork Thu Jun 6 20:46:14 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Makarov X-Patchwork-Id: 249545 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 9FB112C0096 for ; Fri, 7 Jun 2013 06:59:41 +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:mime-version:to:subject:content-type; q= dns; s=default; b=amVIk6x689jQrmbxT9EnzHtsBy4vtYLRlw6SYDB7TfVx1U /HRooojKExBLWm/eSvP9Ln/lUDyifgSVeDjEl/7PhE7DfIkr+jPX4Jxp6RVRHQ16 9UajNJDF5Kh8wRobTQOotfKFs9jOAv85b6mfbE5VqKGZeiRhPZLoBmU9ui4nY= 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:mime-version:to:subject:content-type; s= default; bh=kBGzZcDlhPLE6xLZ+wIVqqexD90=; b=mEm+QcPt+gPyavg/EyVN Y1mvHi5gjGtQCB7sl9h8ilQgul1yzuRb0yi/aW7XWCitSmoULhzWjEy763bnLBAg 07HFzkB4YhTrMinP/+2wJs7XKR2ffKDF5geLUDfNTU9OhWFabvlI+KCwLfDglN5h bsLzzfo4eT+bC4k0mXVvjLw= Received: (qmail 4925 invoked by alias); 6 Jun 2013 20:59:34 -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 4915 invoked by uid 89); 6 Jun 2013 20:59:34 -0000 X-Spam-SWARE-Status: No, score=-6.8 required=5.0 tests=AWL, BAYES_00, RCVD_IN_HOSTKARMA_W, RCVD_IN_HOSTKARMA_WL, RP_MATCHES_RCVD, SPF_HELO_PASS, SPF_PASS autolearn=ham version=3.3.1 Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Thu, 06 Jun 2013 20:59:33 +0000 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r56KxV6F011074 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 6 Jun 2013 16:59:32 -0400 Received: from toll.usersys.redhat.com (toll.yyz.redhat.com [10.15.16.165]) by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id r56KxVV1014701 for ; Thu, 6 Jun 2013 16:59:31 -0400 Message-ID: <51B0F516.2020306@redhat.com> Date: Thu, 06 Jun 2013 16:46:14 -0400 From: Vladimir Makarov User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130311 Thunderbird/17.0.4 MIME-Version: 1.0 To: gcc-patches Subject: patch to fix PR57459 X-Virus-Found: No The following patch fixes http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57459 The bug occurs in case of rare combination when insn uses inherited and original value, the pseudo is input and output and the pseudo value (as insn result) is unused. The patch was successfully bootstrapped and tested on x86/x86-64. Committed as rev. 199762. 2013-06-06 Vladimir Makarov PR rtl-optimization/57459 * lra-constraints.c (update_ebb_live_info): Fix typo for operand type when setting live regs. 2013-06-06 Vladimir Makarov PR rtl-optimization/57459 * gcc.target/i386/pr57459.c: New test. Index: lra-constraints.c =================================================================== --- lra-constraints.c (revision 199753) +++ lra-constraints.c (working copy) @@ -4545,7 +4545,7 @@ update_ebb_live_info (rtx head, rtx tail bitmap_clear_bit (&live_regs, reg->regno); /* Mark each used value as live. */ for (reg = curr_id->regs; reg != NULL; reg = reg->next) - if (reg->type == OP_IN + if (reg->type != OP_OUT && bitmap_bit_p (&check_only_regs, reg->regno)) bitmap_set_bit (&live_regs, reg->regno); /* It is quite important to remove dead move insns because it Index: testsuite/gcc.target/i386/pr57459.c =================================================================== --- testsuite/gcc.target/i386/pr57459.c (revision 0) +++ testsuite/gcc.target/i386/pr57459.c (working copy) @@ -0,0 +1,60 @@ +/* PR rtl-optimization/57459 */ +/* { dg-do run } */ +/* { dg-options "-fno-inline -O2 -minline-all-stringops -fno-omit-frame-pointer" } */ + +int total1[10], total2[10], total3[10], total4[10], total5[10], a[20]; +int len; + +void stackclean() { + void *ptr = __builtin_alloca(20000); + __builtin_memset(ptr, 0, 20000); +} + +void foo(const char *s) { + int r1 = a[1]; + int r2 = a[2]; + int r3 = a[3]; + int r4 = a[4]; + int r5 = a[5]; + + len = __builtin_strlen(s); + + if (s != 0) + return; + + while (r1) { + total1[r1] = r1; + r1--; + } + + while (r2) { + total2[r2] = r2; + r2--; + } + + while (r3) { + total3[r3] = r3; + r3--; + } + + while (r4) { + total4[r4] = r4; + r4--; + } + + while (r5) { + total5[r5] = r5; + r5--; + } +} + +extern void abort (void); + +int main() { + stackclean(); + foo("abcdefgh"); + if (len != 8) + abort (); + return 0; +} +