From patchwork Fri May 23 07:23:25 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhenqiang Chen X-Patchwork-Id: 30678 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-pa0-f70.google.com (mail-pa0-f70.google.com [209.85.220.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id C9B8320369 for ; Fri, 23 May 2014 07:23:46 +0000 (UTC) Received: by mail-pa0-f70.google.com with SMTP id lj1sf16323835pab.1 for ; Fri, 23 May 2014 00:23:45 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:mailing-list:precedence:list-id :list-unsubscribe:list-archive:list-post:list-help:sender :delivered-to:mime-version:date:message-id:subject:from:to :x-original-sender:x-original-authentication-results:content-type; bh=U5/Ejut7Wy2xNwuN/NoxFGpSalI08W7DslABUHoUplQ=; b=PqaDd3RqOFMTBY5nRiWiWCWSujo+4T5BrGfrw7YN9RVqRgvXNVYV+xMVjmwLTZDCMU BG1JoXGjKKEYHqkBd2JAe3eq3+EnwnF3Cd+8U6txkNPLnGr2FYi78BSO12hHfNsS3slO CRgfaIf81GMFsjb93Sb6t87vfd4PUIFwF57WRq9xuJdt1wM/VD6eGcyyndb9oYt2AVaP Cj/0OTiAgr5Lx3NraIhuoa8FnzKSRmXqBqqb8CpomJ4ONnB10tiDAqrdflpeUKaZ3A3E k4w4qRUylBFdc1gJo183Onz9z6uoG2+XtRUrb21JHtjmzXSJAFYZXbMI2OmgEJExuOla 3TFw== X-Gm-Message-State: ALoCoQlLFNrfpoKkW6+Ch1X60sJixNpRod8xjIRa3OG577HTVJhD/qpv6d8ORneLcWdQoSCrjqXv X-Received: by 10.66.222.129 with SMTP id qm1mr1479160pac.6.1400829825310; Fri, 23 May 2014 00:23:45 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.50.143 with SMTP id s15ls1587126qga.33.gmail; Fri, 23 May 2014 00:23:45 -0700 (PDT) X-Received: by 10.52.96.8 with SMTP id do8mr1136880vdb.4.1400829825189; Fri, 23 May 2014 00:23:45 -0700 (PDT) Received: from mail-ve0-x22f.google.com (mail-ve0-x22f.google.com [2607:f8b0:400c:c01::22f]) by mx.google.com with ESMTPS id qy9si1188297vcb.69.2014.05.23.00.23.45 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 23 May 2014 00:23:45 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 2607:f8b0:400c:c01::22f as permitted sender) client-ip=2607:f8b0:400c:c01::22f; Received: by mail-ve0-f175.google.com with SMTP id jw12so5726216veb.6 for ; Fri, 23 May 2014 00:23:45 -0700 (PDT) X-Received: by 10.220.12.66 with SMTP id w2mr2614179vcw.15.1400829825047; Fri, 23 May 2014 00:23:45 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.220.221.72 with SMTP id ib8csp9094vcb; Fri, 23 May 2014 00:23:44 -0700 (PDT) X-Received: by 10.66.119.136 with SMTP id ku8mr3354647pab.121.1400829824346; Fri, 23 May 2014 00:23:44 -0700 (PDT) Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id kc2si2592063pbc.148.2014.05.23.00.23.43 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 23 May 2014 00:23:44 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-return-368338-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Received: (qmail 22990 invoked by alias); 23 May 2014 07:23:32 -0000 Mailing-List: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org Precedence: list 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 22971 invoked by uid 89); 23 May 2014 07:23:30 -0000 X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.5 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-ve0-f169.google.com Received: from mail-ve0-f169.google.com (HELO mail-ve0-f169.google.com) (209.85.128.169) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Fri, 23 May 2014 07:23:28 +0000 Received: by mail-ve0-f169.google.com with SMTP id jx11so5772266veb.14 for ; Fri, 23 May 2014 00:23:26 -0700 (PDT) MIME-Version: 1.0 X-Received: by 10.58.195.130 with SMTP id ie2mr2648157vec.3.1400829805906; Fri, 23 May 2014 00:23:25 -0700 (PDT) Received: by 10.221.51.18 with HTTP; Fri, 23 May 2014 00:23:25 -0700 (PDT) Date: Fri, 23 May 2014 15:23:25 +0800 Message-ID: Subject: [PATCH] Fix PR rtl-optimization/61278 From: Zhenqiang Chen To: "gcc-patches@gcc.gnu.org" X-IsSubscribed: yes X-Original-Sender: zhenqiang.chen@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 2607:f8b0:400c:c01::22f as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org; dkim=pass header.i=@gcc.gnu.org X-Google-Group-Id: 836684582541 Hi, The patch fixes PR rtl-optimization/61278. Root cause for issue is that df_live does not exist at -O1. Bootstrap and no make check regression on X86-64. OK for trunk? Thanks! -Zhenqiang ChangeLog: 2014-05-23 Zhenqiang Chen PR rtl-optimization/61278 * shrink-wrap.c (move_insn_for_shrink_wrap): Check df_live. testsuite/ChangeLog: 2014-05-23 Zhenqiang Chen * gcc.dg/lto/pr61278_0.c: New test. * gcc.dg/lto/pr61278_1.c: New test. diff --git a/gcc/shrink-wrap.c b/gcc/shrink-wrap.c index f09cfe7..be17829 100644 --- a/gcc/shrink-wrap.c +++ b/gcc/shrink-wrap.c @@ -204,8 +204,15 @@ move_insn_for_shrink_wrap (basic_block bb, rtx insn, /* Create a new basic block on the edge. */ if (EDGE_COUNT (next_block->preds) == 2) { + /* If DF_LIVE doesn't exist, i.e. at -O1, just give up. */ + if (!df_live) + return false; + next_block = split_edge (live_edge); + /* We create a new basic block. Call df_grow_bb_info to make sure + all data structures are allocated. */ + df_grow_bb_info (df_live); bitmap_copy (df_get_live_in (next_block), df_get_live_out (bb)); df_set_bb_dirty (next_block); diff --git a/gcc/testsuite/gcc.dg/lto/pr61278_0.c b/gcc/testsuite/gcc.dg/lto/pr61278_0.c new file mode 100644 index 0000000..03a24ae --- /dev/null +++ b/gcc/testsuite/gcc.dg/lto/pr61278_0.c @@ -0,0 +1,30 @@ +/* { dg-lto-do link } */ +/* { dg-lto-options { { -flto -O0 } } } */ +/* { dg-extra-ld-options " -flto -O1 " } */ + +static unsigned int +fn1 (int p1, int p2) +{ + return 0; +} + +char a, b, c; + +char +foo (char *p) +{ + int i; + for (b = 1 ; b > 0; b++) + { + for (i = 0; i < 2; i++) + ; + for (a = 1; a > 0; a++) + { + char d[1] = { 0 }; + if (*p) + break; + c ^= fn1 (fn1 (fn1 (0, 0), 0), 0); + } + } + return 0; +} diff --git a/gcc/testsuite/gcc.dg/lto/pr61278_1.c b/gcc/testsuite/gcc.dg/lto/pr61278_1.c new file mode 100644 index 0000000..b02c8ac --- /dev/null +++ b/gcc/testsuite/gcc.dg/lto/pr61278_1.c @@ -0,0 +1,13 @@ +/* { dg-lto-do link } */ +/* { dg-lto-options { { -flto -O1 } } } */ + +extern char foo (char *); + +char d; + +int +main () +{ + foo (&d); + return 0; +}