From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17659 invoked by alias); 19 Dec 2012 10:32:42 -0000 Received: (qmail 17648 invoked by uid 22791); 19 Dec 2012 10:32:41 -0000 X-SWARE-Spam-Status: No, hits=-1.8 required=5.0 tests=AWL,BAYES_00,KHOP_RCVD_UNTRUST,RCVD_IN_DNSWL_LOW,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; Wed, 19 Dec 2012 10:32:37 +0000 Received: from occam.kam.mff.cuni.cz (occam.kam.mff.cuni.cz [195.113.17.166]) by nikam.ms.mff.cuni.cz (Postfix) with ESMTP id 5C2FC542BC8 for ; Wed, 19 Dec 2012 11:32:34 +0100 (CET) Received: by occam.kam.mff.cuni.cz (Postfix, from userid 16202) id 55BFE220420; Wed, 19 Dec 2012 11:32:34 +0100 (CET) Date: Wed, 19 Dec 2012 10:32:00 -0000 From: Jan Hubicka To: gcc-patches@gcc.gnu.org Subject: Fix ipa-inline-transform ICE Message-ID: <20121219103234.GA11928@kam.mff.cuni.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.20 (2009-06-14) 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: 2012-12/txt/msg01174.txt.bz2 Hi, the ipa-inline-transform ICE is caused by fact that devirt_benefit in ipa-inline-analysis is able to determine devirtualiation oppurtunity of call to b3, while the ipa-prop responsible for updating function body after inlining is not. This is because the later is missing code turning known constant into binfo. Bootstrapped/regtested x86_64-linux, will commit this shortly. Honza PR tree-optimization/55683 * g++.dg/ipa/devirt-9.C: New testcase. * ipa-prop.c (try_make_edge_direct_virtual_call): Look into constants for binfo. Index: testsuite/g++.dg/ipa/devirt-9.C =================================================================== *** testsuite/g++.dg/ipa/devirt-9.C (revision 0) --- testsuite/g++.dg/ipa/devirt-9.C (revision 0) *************** *** 0 **** --- 1,30 ---- + /* { dg-do compile } */ + /* { dg-options "-O2 -fdump-ia-inline" } */ + double foo (); + struct B + { + bool b1 () { return b3 (); } + void b2 (); + virtual bool b3 (); + }; + struct C + { + C () {} + bool + c1 (float x, float y) + { + if (x != c3 || y != c4) + c2.b2 (); + return c2.b1 (); + } + B c2; + float c3, c4; + }; + + void + bar () + { + static C c; + c.c1 (60, (int) foo ()); + } + /* { dg-final { scan-ipa-dump "Discovered a virtual call to a known target" "inline" } } */ Index: ipa-prop.c =================================================================== *** ipa-prop.c (revision 194584) --- ipa-prop.c (working copy) *************** try_make_edge_direct_virtual_call (struc *** 2223,2231 **** binfo = ipa_value_from_jfunc (new_root_info, jfunc); ! if (!binfo || TREE_CODE (binfo) != TREE_BINFO) return NULL; binfo = get_binfo_at_offset (binfo, ie->indirect_info->offset, ie->indirect_info->otr_type); if (binfo) --- 2223,2238 ---- binfo = ipa_value_from_jfunc (new_root_info, jfunc); ! if (!binfo) return NULL; + if (TREE_CODE (binfo) != TREE_BINFO) + { + binfo = gimple_extract_devirt_binfo_from_cst (binfo); + if (!binfo) + return NULL; + } + binfo = get_binfo_at_offset (binfo, ie->indirect_info->offset, ie->indirect_info->otr_type); if (binfo)