From patchwork Thu Dec 22 00:12:03 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rong Xu X-Patchwork-Id: 132761 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id 1FC53B7143 for ; Thu, 22 Dec 2011 11:12:21 +1100 (EST) Received: (qmail 2710 invoked by alias); 22 Dec 2011 00:12:19 -0000 Received: (qmail 2700 invoked by uid 22791); 22 Dec 2011 00:12:18 -0000 X-SWARE-Spam-Status: No, hits=-3.6 required=5.0 tests=AWL, BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, RCVD_IN_DNSWL_LOW, RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mail-gx0-f201.google.com (HELO mail-gx0-f201.google.com) (209.85.161.201) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 22 Dec 2011 00:12:04 +0000 Received: by ggnv5 with SMTP id v5so1026664ggn.2 for ; Wed, 21 Dec 2011 16:12:04 -0800 (PST) Received: by 10.101.196.35 with SMTP id y35mr4969458anp.4.1324512724033; Wed, 21 Dec 2011 16:12:04 -0800 (PST) Received: by 10.101.196.35 with SMTP id y35mr4969446anp.4.1324512723908; Wed, 21 Dec 2011 16:12:03 -0800 (PST) Received: from wpzn4.hot.corp.google.com (216-239-44-65.google.com [216.239.44.65]) by gmr-mx.google.com with ESMTPS id k7si3064142yhm.1.2011.12.21.16.12.03 (version=TLSv1/SSLv3 cipher=AES128-SHA); Wed, 21 Dec 2011 16:12:03 -0800 (PST) Received: from rong.mtv.corp.google.com (rong.mtv.corp.google.com [172.18.110.233]) by wpzn4.hot.corp.google.com (Postfix) with ESMTP id C96DB1E005B; Wed, 21 Dec 2011 16:12:03 -0800 (PST) Received: by rong.mtv.corp.google.com (Postfix, from userid 104659) id 3F37EC0921; Wed, 21 Dec 2011 16:12:03 -0800 (PST) To: reply@codereview.appspotmail.com,gcc-patches@gcc.gnu.org Subject: [google] fix ICE when using LIPO profiles for FDO (issue5500068) Message-Id: <20111222001203.3F37EC0921@rong.mtv.corp.google.com> Date: Wed, 21 Dec 2011 16:12:03 -0800 (PST) From: xur@google.com (Rong Xu) X-IsSubscribed: yes Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org This patch is for google_main branch only. This patch fixes the ICE when using LIPO profiles for regular FDO compilation. LIPO has INDIR_CALL_TOPN profiles while FDO has INDIR_CALL profile. Tested with SPEC2000 INT (with -Wno-coverage-mismatch to work around the minor pass difference b/w LIPO and FDO) -Rong 2011-12-21 Rong Xu * gcc/profile.c (compute_value_histograms): handle the case when INDIR_CALL counters not available in gcda files. --- This patch is available for review at http://codereview.appspot.com/5500068 Index: gcc/profile.c =================================================================== --- gcc/profile.c (revision 182415) +++ gcc/profile.c (working copy) @@ -828,6 +828,19 @@ t = (int) hist->type; aact_count = act_count[t]; + if (aact_count == 0) + { + /* this can only happen when FDO uses LIPO profiles where + we have HIST_TYPE_INDIR_CALL_TOPN counters in gcda + files. */ + gcc_assert (hist->type == HIST_TYPE_INDIR_CALL); + if (flag_opt_info >= OPT_INFO_MIN) + warning (0, "cannot find INDIR_CALL counters. " + "Using LIPO profiles?\n", + DECL_ASSEMBLER_NAME (current_function_decl)); + hist->n_counters = 0; + continue; + } act_count[t] += hist->n_counters; gimple_add_histogram_value (cfun, stmt, hist);