From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18284 invoked by alias); 29 Mar 2012 15:25:18 -0000 Received: (qmail 18231 invoked by uid 22791); 29 Mar 2012 15:25:16 -0000 X-SWARE-Spam-Status: No, hits=-2.2 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW X-Spam-Check-By: sourceware.org Received: from mail-yx0-f175.google.com (HELO mail-yx0-f175.google.com) (209.85.213.175) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 29 Mar 2012 15:25:03 +0000 Received: by yenm3 with SMTP id m3so1628636yen.20 for ; Thu, 29 Mar 2012 08:25:03 -0700 (PDT) MIME-Version: 1.0 Received: by 10.236.170.71 with SMTP id o47mr33943802yhl.104.1333034702954; Thu, 29 Mar 2012 08:25:02 -0700 (PDT) Received: by 10.147.153.12 with HTTP; Thu, 29 Mar 2012 08:25:02 -0700 (PDT) In-Reply-To: References: Date: Thu, 29 Mar 2012 15:25:00 -0000 Message-ID: Subject: Re: Missed optimization in PRE? From: "Bin.Cheng" To: Richard Guenther Cc: gcc@gcc.gnu.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-IsSubscribed: yes Mailing-List: contact gcc-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-owner@gcc.gnu.org X-SW-Source: 2012-03/txt/msg00476.txt.bz2 On Thu, Mar 29, 2012 at 6:14 PM, Richard Guenther wrote: > On Thu, Mar 29, 2012 at 12:10 PM, Bin.Cheng wrote: >> On Thu, Mar 29, 2012 at 6:07 PM, Richard Guenther >> wrote: >>> On Thu, Mar 29, 2012 at 12:02 PM, Bin.Cheng wro= te: >>>> Hi, >>>> Following is the tree dump of 094t.pre for a test program. >>>> Question is loads of D.5375_12/D.5375_14 are redundant on path >>> bb7, bb5, bb6>, >>>> but why not lowered into basic block 3, where it is used. >>>> >>>> BTW, seems no tree pass handles this case currently. >>> >>> tree-ssa-sink.c should do this. >>> >> It does not work for me, I will double check and update soon. > > Well, "should" as in, it's the place to do it. =A0And certainly the pass = can sink > loads, so this must be a missed optimization. > Curiously, it is said explicitly that "We don't want to sink loads from mem= ory." in tree-ssa-sink.c function statement_sink_location, and the condition is if (stmt_ends_bb_p (stmt) || gimple_has_side_effects (stmt) || gimple_has_volatile_ops (stmt) || (gimple_vuse (stmt) && !gimple_vdef (stmt)) <-----------------check load || (cfun->has_local_explicit_reg_vars && TYPE_MODE (TREE_TYPE (gimple_assign_lhs (stmt))) =3D=3D BLKmode)) return false; I haven't found any clue about this decision in ChangeLogs. --=20 Best Regards.