From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2485 invoked by alias); 4 Jun 2011 14:25:43 -0000 Received: (qmail 2472 invoked by uid 22791); 4 Jun 2011 14:25:42 -0000 X-SWARE-Spam-Status: No, hits=-1.8 required=5.0 tests=AWL,BAYES_00,T_RP_MATCHES_RCVD 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, 04 Jun 2011 14:25:25 +0000 Received: by nikam.ms.mff.cuni.cz (Postfix, from userid 16202) id D8BF69AC819; Sat, 4 Jun 2011 16:25:23 +0200 (CEST) Date: Sat, 04 Jun 2011 14:25:00 -0000 From: Jan Hubicka To: gcc-patches@gcc.gnu.org Subject: Fix estimate_size_after_inlining ICE Message-ID: <20110604142523.GA30668@kam.mff.cuni.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline 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-06/txt/msg00309.txt.bz2 Hi, the problem here is that we propagate predicates inconsistently through inlining breaking the transitivity that is assumed by the size estimate. Regtested/bootstrapped x86_64-linux, comitted. Honza PR tree-optimize/48929 * gcc.c-torture/compile/pr48929.c: New testcase. * ipa-inline-analysis.c (remap_edge_predicates): Fix handling of empty predicate. Index: testsuite/gcc.c-torture/compile/pr48929.c =================================================================== *** testsuite/gcc.c-torture/compile/pr48929.c (revision 0) --- testsuite/gcc.c-torture/compile/pr48929.c (revision 0) *************** *** 0 **** --- 1,32 ---- + /*{ dg-options "-O -findirect-inlining" }*/ + void bar (); + + static void + f4 (double di, double d, double *dd) + { + if (d == 0 && di == 0) + *dd = 0; + bar (); + } + + static inline void + f3 (int i, double d) + { + double di = i; + double dd; + f4 (di, d, &dd); + } + + static inline void + f2 (int i, double d) + { + if (d < 0) + f3 (i, d); + } + + void + f1 () + { + f2 (0, 1); + } + Index: ipa-inline-analysis.c =================================================================== *** ipa-inline-analysis.c (revision 174610) --- ipa-inline-analysis.c (working copy) *************** remap_edge_predicates (struct cgraph_nod *** 1949,1954 **** --- 1949,1956 ---- if (!e->inline_failed) remap_edge_predicates (e->callee, info, callee_info, operand_map, possible_truths, toplev_predicate); + else + edge_set_predicate (e, toplev_predicate); } for (e = node->indirect_calls; e; e = e->next_callee) { *************** remap_edge_predicates (struct cgraph_nod *** 1969,1974 **** --- 1971,1978 ---- e->frequency = 0; } } + else + edge_set_predicate (e, toplev_predicate); } } Index: ipa-prop.c ===================================================================