From patchwork Tue Oct 29 18:42:47 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Teresa Johnson X-Patchwork-Id: 287022 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 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 7D7BC2C0366 for ; Wed, 30 Oct 2013 05:42:59 +1100 (EST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :mime-version:date:message-id:subject:from:to:cc:content-type; q=dns; s=default; b=kTvbhwD6Dr21jNxrDY47ld1ul1uVgvsphEplkt2qB9Z 7g4pKLFQhMQWL5dJTr4SsHbYVCapNOfuH6INWxQJcOwmm5MNZ0CK21bfNDrim5cG JL0f3lIr6e7veKoWqNL0CaKrOkQf+D81rPvQ9qe/YtPd6BrNH9M2OvPv8VQyhj+8 = 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 :mime-version:date:message-id:subject:from:to:cc:content-type; s=default; bh=9ZMgzzU6QD7yodeGbWiJCeuuqAo=; b=cnrhIO9l6Y7IaqVwL 6m2J1g2jdAspF6onX1vHH6MgnRhtCxE8qmGnb58945f9DDlajUQC4CL+nFVAAgqO XPL9r0osF+IDY2hrAV0RDbcb9bquDIOG1+fCXpowCW4ecojqS65YdEyHyhQt/nJY 3Qb8TEol5ioBtEs85JUiectc+E= Received: (qmail 21831 invoked by alias); 29 Oct 2013 18:42:52 -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 21811 invoked by uid 89); 29 Oct 2013 18:42:51 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.5 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_LOW, RP_MATCHES_RCVD, SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-qc0-f171.google.com Received: from mail-qc0-f171.google.com (HELO mail-qc0-f171.google.com) (209.85.216.171) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Tue, 29 Oct 2013 18:42:50 +0000 Received: by mail-qc0-f171.google.com with SMTP id i7so174208qcq.2 for ; Tue, 29 Oct 2013 11:42:47 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:date:message-id:subject:from:to:cc :content-type; bh=mAMiv7bsFGrhdCry6tnKEel5sV/b7GFMYe8w5NY1t6k=; b=FKIrd06CtjnjD82ulMK/ba41BKwL/pcbLHfz9rTUAe4QyG/CR69CjS4lX4HucNJHcr +hne/OaBMPalDJ3B76Fu4qjLPfLPDmGVafJapU8FG7090jDd12YITU5FEwX/gQXVGEAS mev8AD9QEAFo3lB6fnbWqCM8dT88bo8fPhLRHIxdxkdnynC2RlDxu/W3nQVRwgKFii4L wt9ykfAqxwERsMnAAm4qcSJlfAnFWN8V/fTDaI5jdgLGkLbIXGAkSOM9EHHaG1orSHbQ K22mZlNzwqBT8LKGIt4p4QcY25W+ifPY2iU/n0hWfL8uD552FGFpTCtGB5nfbDsoQLvX BPBA== X-Gm-Message-State: ALoCoQl7xevrzFYgXy9/GAbcPMJnF2mKzdsCORdwbuOLrkrQeKMi3e50wZkOC9VNNsC/3a4MHxvIhM7nz/qrZfmQV6N4TqgLF/E3fbx9kg5/8wmuY0S55tLeOMgmHHBaXH1jHf+sgF7y8Em3QLmRo1VOi/BobYjxUN4Vdu9DR4FdRFuQ1sq4VM1BVrze7Y+gccRykCleaFEU3wjuxIhxypGw5UvJqG5zCw== MIME-Version: 1.0 X-Received: by 10.224.4.70 with SMTP id 6mr2831164qaq.86.1383072167445; Tue, 29 Oct 2013 11:42:47 -0700 (PDT) Received: by 10.229.117.69 with HTTP; Tue, 29 Oct 2013 11:42:47 -0700 (PDT) Date: Tue, 29 Oct 2013 11:42:47 -0700 Message-ID: Subject: [PATCH] Fix PR ipa/58862 (profiled bootstrap failure) From: Teresa Johnson To: "gcc-patches@gcc.gnu.org" Cc: Jan Hubicka , Uros Bizjak X-IsSubscribed: yes This patch fixes a profiledbootstrap failure that occurred after I added some profile fixup. The initial profile insanity occurred upstream of my change, but my change caused the insanity to spread to the edge probability, resulting in a verify failure. The patch below ensures this doesn't occur. Bootstrapped and tested on x86-64-unknown-linux-gnu. A profiledbootstrap build also now succeeds. Ok for trunk? Thanks, Teresa 2013-10-29 Teresa Johnson PR ipa/58862 * tree-ssa-tail-merge.c (replace_block_by): Tolerate profile insanities when updating probabilities. Index: tree-ssa-tail-merge.c =================================================================== --- tree-ssa-tail-merge.c (revision 204166) +++ tree-ssa-tail-merge.c (working copy) @@ -1467,7 +1467,7 @@ static void replace_block_by (basic_block bb1, basic_block bb2) { edge pred_edge; - edge e1; + edge e1, e2; edge_iterator ei; unsigned int i; gimple bb2_phi; @@ -1502,16 +1502,22 @@ replace_block_by (basic_block bb1, basic_block bb2 bb2->count += bb1->count; /* Merge the outgoing edge counts from bb1 onto bb2. */ + gcov_type out_sum = 0; FOR_EACH_EDGE (e1, ei, bb1->succs) { - edge e2; e2 = find_edge (bb2, e1->dest); gcc_assert (e2); e2->count += e1->count; - /* Recompute the probability from the new merged edge count (bb2->count - was updated above). */ - e2->probability = GCOV_COMPUTE_SCALE (e2->count, bb2->count); + out_sum += e2->count; } + /* Recompute the edge probabilities from the new merged edge count. + Use the sum of the new merged edge counts computed above instead + of bb2's merged count, in case there are profile count insanities + making the bb count inconsistent with the edge weights. */ + FOR_EACH_EDGE (e2, ei, bb2->succs) + { + e2->probability = GCOV_COMPUTE_SCALE (e2->count, out_sum); + } /* Do updates that use bb1, before deleting bb1. */ release_last_vdef (bb1);