From patchwork Mon Jul 3 12:16:53 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Hubicka X-Patchwork-Id: 783443 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]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3x1R2y4bbyz9s3T for ; Mon, 3 Jul 2017 22:17:13 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="JcFF/o2V"; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:subject:message-id:mime-version:content-type; q=dns; s= default; b=AO4tzC1VqnzUieVMGD9ZzgvPhncSmniy04FOhrDKOtN9aD2DZUXve 1XnWk80xiVCUQOBPIoU0ZpZUOfJ8tcpQcCdDUczeGGZOrR33LQStGJCM86zzjyc+ HwCjYA//9+QPCMS01eE0Aux/INAZHDFPhUrOvn06kiN/D5qmOvWhqw= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:subject:message-id:mime-version:content-type; s= default; bh=3swLy9MVGC61rgatAf3aV+ve0bw=; b=JcFF/o2VOQsEn0kSOfud 6Ifsrg5Dqy3gMHMxkfTTt/mQVph05LNf1Seoz5bzApDoZYsNePyc0EeBMD+AbMX3 8Ka8RZ4Q9M8iMAoCQHAyR38isZ5OPPPoYrG+46AGvyHb//jV2s2ldTz/gHdBWRA/ pdU/F1ZPFFhhGtXs4y918FM= Received: (qmail 82382 invoked by alias); 3 Jul 2017 12:17:05 -0000 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 Received: (qmail 82189 invoked by uid 89); 3 Jul 2017 12:16:58 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-10.2 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_2, GIT_PATCH_3, KAM_LAZY_DOMAIN_SECURITY, RP_MATCHES_RCVD autolearn=ham version=3.3.2 spammy=Hx-languages-length:1587 X-HELO: nikam.ms.mff.cuni.cz Received: from nikam.ms.mff.cuni.cz (HELO nikam.ms.mff.cuni.cz) (195.113.20.16) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 03 Jul 2017 12:16:55 +0000 Received: by nikam.ms.mff.cuni.cz (Postfix, from userid 16202) id 63BD9543A28; Mon, 3 Jul 2017 14:16:53 +0200 (CEST) Date: Mon, 3 Jul 2017 14:16:53 +0200 From: Jan Hubicka To: gcc-patches@gcc.gnu.org Subject: Fix profile updating on loop-doloop Message-ID: <20170703121653.GB48026@kam.mff.cuni.cz> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.23 (2014-03-12) Hi, this patch fixes powerPC bootstrap ICE caused by doloop incorrectly updating profile. Comitted. PR bootstrap/81285 * loop-doloop.c (add_test): Update profile. Index: loop-doloop.c =================================================================== --- loop-doloop.c (revision 249885) +++ loop-doloop.c (working copy) @@ -347,6 +347,8 @@ add_test (rtx cond, edge *e, basic_block rtx op0 = XEXP (cond, 0), op1 = XEXP (cond, 1); enum rtx_code code = GET_CODE (cond); basic_block bb; + /* The jump is supposed to handle an unlikely special case. */ + profile_probability prob = profile_probability::guessed_never (); mode = GET_MODE (XEXP (cond, 0)); if (mode == VOIDmode) @@ -357,7 +359,7 @@ add_test (rtx cond, edge *e, basic_block op1 = force_operand (op1, NULL_RTX); label = block_label (dest); do_compare_rtx_and_jump (op0, op1, code, 0, mode, NULL_RTX, NULL, label, - profile_probability::uninitialized ()); + prob); jump = get_last_insn (); if (!jump || !JUMP_P (jump)) @@ -387,12 +389,14 @@ add_test (rtx cond, edge *e, basic_block JUMP_LABEL (jump) = label; - /* The jump is supposed to handle an unlikely special case. */ - add_int_reg_note (jump, REG_BR_PROB, 0); - LABEL_NUSES (label)++; - make_edge (bb, dest, (*e)->flags & ~EDGE_FALLTHRU); + edge e2 = make_edge (bb, dest, (*e)->flags & ~EDGE_FALLTHRU); + e2->probability = prob; + e2->count = e2->src->count.apply_probability (prob); + (*e)->probability = prob.invert (); + (*e)->count = (*e)->count.apply_probability (prob); + update_br_prob_note (e2->src); return true; }