From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 11056 invoked by alias); 4 Apr 2002 16:16:04 -0000 Mailing-List: contact gcc-prs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-prs-owner@gcc.gnu.org Received: (qmail 11036 invoked by uid 71); 4 Apr 2002 16:16:03 -0000 Date: Thu, 04 Apr 2002 08:16:00 -0000 Message-ID: <20020404161603.11033.qmail@sources.redhat.com> To: nobody@gcc.gnu.org Cc: gcc-prs@gcc.gnu.org, From: law@redhat.com Subject: Re: optimization/5738: GCSE missed optimization Reply-To: law@redhat.com X-SW-Source: 2002-04/txt/msg00338.txt.bz2 List-Id: The following reply was made to PR optimization/5738; it has been noted by GNATS. From: law@redhat.com To: Daniel Berlin Cc: rth@gcc.gnu.org, dann@godzilla.ics.uci.edu, gcc-bugs@gcc.gnu.org, gcc-prs@gcc.gnu.org, nobody@gcc.gnu.org, gcc-gnats@gcc.gnu.org Subject: Re: optimization/5738: GCSE missed optimization Date: Thu, 04 Apr 2002 09:11:30 -0700 In message , Daniel Berlin > > No, the main object of PRE (besides performing GCSE) is to suppress > > partial redundancies. > > IE expressions that are available along one or more paths, but missing fro > m some path. > > It does so by making it fully redundant, copying it to a block (or > > blocks) such that it reaches all of the paths. It then eliminates the > > other copies. > > See, for instance http://www.cs.rice.edu/~keith/512/Lectures/LCM.pdf, > which explains this quite well in the first few pages. As does Morgan, Muchnick and the various papers in PLDI. Our implementation is directly derived from Morgan. > we have something like > > if (b) > { > a; > c; > } > else > { > a; > d; > } > > which is a job for PRE. If you have something like this, then that's not a job for PRE/LCM as no path through the CFG has more than one evaluation of "a". What you're looking for is actually tail merging, which would drop "a" down the CFG. If you wanted to move "a" up in the CFG you should look at the code hoisting code, which we enable at -Os. Jeff