From patchwork Tue May 20 07:11:08 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhenqiang Chen X-Patchwork-Id: 30409 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-pb0-f72.google.com (mail-pb0-f72.google.com [209.85.160.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 32207202FE for ; Tue, 20 May 2014 07:11:29 +0000 (UTC) Received: by mail-pb0-f72.google.com with SMTP id ma3sf158257pbc.11 for ; Tue, 20 May 2014 00:11:28 -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:cc :x-original-sender:x-original-authentication-results:content-type; bh=64MWS/YnV2i3zHzDfXNs1ETbgxyiu4iS2X73cekzwBA=; b=XQvvgNOz139g3q6CysPqoAbG6J3yFkkc/Ayp/1bbWYLrkf14tKT7e502+zlZQLi8au hGDoirpSih04TBa3qfODFdMJ+Fyz9/riuFeI3stMiqqqTSfT4vYlP/TX/E4FIUv9T/ej Yqywzv9TTh/VwGMyJdEF99WGS1DjGe7ESnvpDIHJtYPFQQtnl8uQRIsOraSp8CzIm4jD TgVQC5vcRweYd23XEgptoIwScLSx1aetuU9nGMkRNLLLpI4EoKQ1I/q4Okc6Zokv1MyQ va0N9Hjn2Z6bv8lQ2EgzZkqIYLxL8XNiVs+qEMZzF1+SjdfvzUYsRopQT/rRKGvWVP/X wavg== X-Gm-Message-State: ALoCoQn0+LGHzQcetmAHhvKPVcucSyMoX4P7C4GWomHGfBVHCY3dlSDVxcBAPvD2dZt8QSe1+sjP X-Received: by 10.66.138.17 with SMTP id qm17mr18135064pab.34.1400569888411; Tue, 20 May 2014 00:11:28 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.34.46 with SMTP id k43ls121278qgk.58.gmail; Tue, 20 May 2014 00:11:28 -0700 (PDT) X-Received: by 10.52.13.41 with SMTP id e9mr1903149vdc.21.1400569888240; Tue, 20 May 2014 00:11:28 -0700 (PDT) Received: from mail-vc0-x236.google.com (mail-vc0-x236.google.com [2607:f8b0:400c:c03::236]) by mx.google.com with ESMTPS id uc9si4724323vdc.120.2014.05.20.00.11.28 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 20 May 2014 00:11:28 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 2607:f8b0:400c:c03::236 as permitted sender) client-ip=2607:f8b0:400c:c03::236; Received: by mail-vc0-f182.google.com with SMTP id la4so64222vcb.41 for ; Tue, 20 May 2014 00:11:28 -0700 (PDT) X-Received: by 10.58.228.163 with SMTP id sj3mr22720004vec.28.1400569888026; Tue, 20 May 2014 00:11:28 -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 ib8csp7319vcb; Tue, 20 May 2014 00:11:27 -0700 (PDT) X-Received: by 10.67.4.169 with SMTP id cf9mr47992457pad.45.1400569886915; Tue, 20 May 2014 00:11:26 -0700 (PDT) Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id nu2si486208pbc.98.2014.05.20.00.11.26 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 20 May 2014 00:11:26 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-return-367964-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Received: (qmail 14572 invoked by alias); 20 May 2014 07:11:13 -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 14561 invoked by uid 89); 20 May 2014 07:11:13 -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-la0-f54.google.com Received: from mail-la0-f54.google.com (HELO mail-la0-f54.google.com) (209.85.215.54) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Tue, 20 May 2014 07:11:12 +0000 Received: by mail-la0-f54.google.com with SMTP id pv20so37915lab.27 for ; Tue, 20 May 2014 00:11:08 -0700 (PDT) MIME-Version: 1.0 X-Received: by 10.152.29.200 with SMTP id m8mr10810222lah.49.1400569868585; Tue, 20 May 2014 00:11:08 -0700 (PDT) Received: by 10.112.13.36 with HTTP; Tue, 20 May 2014 00:11:08 -0700 (PDT) Date: Tue, 20 May 2014 15:11:08 +0800 Message-ID: Subject: [PATCH] Fix ICE in rtl-optimization/PR61220, PR61225 From: Zhenqiang Chen To: "gcc-patches@gcc.gnu.org" Cc: Jeff Law 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:c03::236 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 fix ICE issue triggered by shrink-wrapping enhancement. Bootstrap and no make check regression on X86-64. OK for trunk? Thanks! -Zhenqiang 2014-05-20 Zhenqiang Chen PR rtl-optimization/61220 Part of PR rtl-optimization/61225 * shrink-wrap.c (move_insn_for_shrink_wrap): Skip SP and FP adjustment insn; skip split_edge for a block without only on successor. testsuite/ChangeLog: 2014-05-20 Zhenqiang Chen * gcc.dg/pr61220.c: New test. * gcc.dg/shrink-wrap-loop.c: Disable for x86_64 -m32 mode. diff --git a/gcc/shrink-wrap.c b/gcc/shrink-wrap.c index f09cfe7..6f1ddc7 100644 --- a/gcc/shrink-wrap.c +++ b/gcc/shrink-wrap.c @@ -179,7 +179,12 @@ move_insn_for_shrink_wrap (basic_block bb, rtx insn, return false; src = SET_SRC (set); dest = SET_DEST (set); - if (!REG_P (dest) || !REG_P (src)) + if (!REG_P (dest) || !REG_P (src) + /* STACK or FRAME related adjustment might be part of prologue. + So keep them in the entry block. */ + || dest == stack_pointer_rtx + || dest == frame_pointer_rtx + || dest == hard_frame_pointer_rtx) return false; /* Make sure that the source register isn't defined later in BB. */ @@ -204,6 +209,10 @@ 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) { + /* split_edge for a block with only one successor is meaningless. */ + if (EDGE_COUNT (bb->succs) == 1) + return false; + next_block = split_edge (live_edge); bitmap_copy (df_get_live_in (next_block), df_get_live_out (bb)); diff --git a/gcc/testsuite/gcc.dg/pr61220.c b/gcc/testsuite/gcc.dg/pr61220.c new file mode 100644 index 0000000..c503ff1 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr61220.c @@ -0,0 +1,39 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -g" } */ + +int a, c, d, e, f, g, h, i, j, k; + +struct S0 +{ + int f0; + int f1; + int f2; +}; + +struct S1 +{ + int f0; + int f1; + struct S0 f2; +} b; + +void +fn1 (struct S1 p) +{ + for (; k; k++) + h = j ? a : a - 1; + d &= i; +} + +int +main () +{ + int l[5] = { 0 }; + fn1 (b); + for (c = 0; c < 3; c++) + for (g = 0; g < 3; g++) + l[c * 2] = e = l[c]; + if (f) + fn1 (b); + return 0; +} diff --git a/gcc/testsuite/gcc.dg/shrink-wrap-loop.c b/gcc/testsuite/gcc.dg/shrink-wrap-loop.c index 17dca4e..e72edfa 100644 --- a/gcc/testsuite/gcc.dg/shrink-wrap-loop.c +++ b/gcc/testsuite/gcc.dg/shrink-wrap-loop.c @@ -1,4 +1,4 @@ -/* { dg-do compile { target { { x86_64-*-* } || { arm_thumb2 } } } } */ +/* { dg-do compile { target { { x86_64-*-* && lp64 } || { arm_thumb2 } } } } */ /* { dg-options "-O2 -fdump-rtl-pro_and_epilogue" } */ int foo (int *p1, int *p2);