From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26536 invoked by alias); 3 Sep 2011 16:41:49 -0000 Received: (qmail 26526 invoked by uid 22791); 3 Sep 2011 16:41:48 -0000 X-SWARE-Spam-Status: No, hits=-2.0 required=5.0 tests=AWL,BAYES_00,RP_MATCHES_RCVD,TW_FW X-Spam-Check-By: sourceware.org Received: from nikam.ms.mff.cuni.cz (HELO nikam.ms.mff.cuni.cz) (195.113.20.16) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sat, 03 Sep 2011 16:41:34 +0000 Received: by nikam.ms.mff.cuni.cz (Postfix, from userid 16202) id AC4589AC80C; Sat, 3 Sep 2011 18:41:31 +0200 (CEST) Date: Sat, 03 Sep 2011 16:41:00 -0000 From: Jan Hubicka To: Ulrich Weigand Cc: Jan Hubicka , gcc-patches@gcc.gnu.org, arnd@arndb.de Subject: Re: Propagate BB predicates in ipa-inline-analysis Message-ID: <20110903164131.GA6534@kam.mff.cuni.cz> References: <20110429211824.GA3820@kam.mff.cuni.cz> <201109021742.p82HgRvp032533@d06av02.portsmouth.uk.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201109021742.p82HgRvp032533@d06av02.portsmouth.uk.ibm.com> User-Agent: Mutt/1.5.18 (2008-05-17) Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org X-SW-Source: 2011-09/txt/msg00222.txt.bz2 > Jan Hubicka wrote: > > > (edge_execution_predicate): Rewrite as... > > (set_cond_stmt_execution_predicate): ... this function; handle > > __builtin_constant_p. > > This causes ICEs when building recent Linux kernels with the > CONFIG_TRACE_BRANCH_PROFLING option. This reduced test case: > > static inline __attribute__((always_inline)) int f (unsigned int n, unsigned int size) > { > return (__builtin_constant_p (size != 0 && n > ~0 / size) > ? !!(size != 0 && n > ~0 / size) > : ({ static unsigned int count[2] = { 0, 0 }; > int r = !!(size != 0 && n > ~0 / size); > count[r]++; > r; })); > } > > int g (unsigned int size) > { > return f (size / 4096, 4); > } > > built with -O2 (on i386) on current mainline results in: > > /home/uweigand/test.i:15:1: internal compiler error: tree check: expected ssa_name, have integer_cst in set_cond_stmt_execution_predicate, at ipa-inline-analysis.c:1190 the code dies on: D.2739_10 = __builtin_constant_p (0); it assumes that argument of __builtin_constant_p is always SSA_NAME. I am testing the obvious fix for that. However it is missed optimization to leave such unfolded statement. It happens at fwprop converting: : iftmp.1_9 = 0; : # iftmp.1_2 = PHI <1(4), 0(5)> D.2739_10 = __builtin_constant_p (iftmp.1_2); Honza > > Bye, > Ulrich > > -- > Dr. Ulrich Weigand > GNU Toolchain for Linux on System z and Cell BE > Ulrich.Weigand@de.ibm.com