From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24147 invoked by alias); 17 Aug 2005 19:31:29 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 23804 invoked by alias); 17 Aug 2005 19:31:10 -0000 Date: Wed, 17 Aug 2005 19:42:00 -0000 Message-ID: <20050817193110.23803.qmail@sourceware.org> From: "law at redhat dot com" To: gcc-bugs@gcc.gnu.org In-Reply-To: <20050131123257.19721.steven@gcc.gnu.org> References: <20050131123257.19721.steven@gcc.gnu.org> Reply-To: gcc-bugzilla@gcc.gnu.org Subject: [Bug middle-end/19721] [meta-bug] optimizations that CSE still catches X-Bugzilla-Reason: CC X-SW-Source: 2005-08/txt/msg02021.txt.bz2 List-Id: ------- Additional Comments From law at redhat dot com 2005-08-17 19:31 ------- Subject: Re: [meta-bug] optimizations that CSE still catches On Wed, 2005-08-17 at 08:03 +0000, bonzini at gcc dot gnu dot org wrote: > ------- Additional Comments From bonzini at gcc dot gnu dot org 2005-08-17 08:03 ------- > This small testcase is a typical case of the optimizations that CSE path > following catches on PowerPC: > > unsigned outcnt; > extern void flush_outbuf(void); > > void > bi_windup(unsigned char *outbuf, unsigned char bi_buf) > { > outbuf[outcnt] = bi_buf; > if (outcnt == 16384) > flush_outbuf(); > outbuf[outcnt] = bi_buf; > } > > Loading outcnt takes *three* insns: one to load the high part of the address, > one to load the low part, one to load from memory. CSE reduces them to two by > combining the loading of the low part with the load from memory. With CSE path > following, in addition, CSE is able to factor the loads of the high part of the > address, and do just one of them. > > Now here comes GCSE. If CSE path following is on, GCSE sees that the third > occurrence of outcnt is the same as the second, and eliminates it. If it is > off, GCSE is wasted to factor the loading of the address high parts. > > So, if we remove a pseudo-global cse pass by disabling path following, it would > make sense to bump the default max-gcse-passes to 2. Presumably the store into outbuf prevents the SSA optimizers from commonizing the first two loads of outcnt and the call to flush_outbuf prevents the SSA optimizers from commonizing the last load of outcnt on the path which bypasses the call to flush_outbuf. Right? Jeff -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19721