From patchwork Thu Feb 19 01:44:07 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: tbsaunde+gcc@tbsaunde.org X-Patchwork-Id: 441517 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 2883C14009B for ; Thu, 19 Feb 2015 12:44:33 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:cc:subject:date:message-id; q=dns; s=default; b=lAz/hZwbPF6A fk4T7CZXNH9zV77Zw40X7bru41KRmDM4bmX4x3YgpFb/MtdgHYIJxoKGvug+Jmg2 IqqWuVSvfeKy9RFI/rJ28Uh+7+V57AYHH/W1x23YsLVcbxoAlCp4J7Q+o30ZqtpY XHdJ+mL0TZnnP1yLjP643H/mgDN739k= 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:from :to:cc:subject:date:message-id; s=default; bh=5XndfHmitLWkI8nRS3 eMYNxmMTg=; b=PWpzVtGafQHSvG74ZOdY+3T3g/dO4sKvk/8HGIrvl+tzE7Zvzy pJ41WyTX6sU/cyLDTjvsmF/vgAEPPBrSD2AAPKQOMXhsrpfCxko8npXe3IC6jUz+ tpcEn0jfFUgPboxkzJiQBsCdM8ysjFv7Kxj2TyvNUqbYagdre1z0iUB2E= Received: (qmail 12408 invoked by alias); 19 Feb 2015 01:44:25 -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 12379 invoked by uid 89); 19 Feb 2015 01:44:23 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=AWL, BAYES_00, T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: paperclip.tbsaunde.org Received: from tbsaunde.org (HELO paperclip.tbsaunde.org) (66.228.47.254) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 19 Feb 2015 01:44:22 +0000 Received: from iceball.corp.tor1.mozilla.com (unknown [66.207.208.102]) by paperclip.tbsaunde.org (Postfix) with ESMTPSA id 330CAC0B5; Thu, 19 Feb 2015 01:44:20 +0000 (UTC) From: tbsaunde+gcc@tbsaunde.org To: gcc-patches@gcc.gnu.org Cc: Trevor Saunders Subject: [PATCH] sem_function::bb_dict_test should take a vec * Date: Wed, 18 Feb 2015 20:44:07 -0500 Message-Id: <1424310247-3852-1-git-send-email-tbsaunde+gcc@tbsaunde.org> X-IsSubscribed: yes From: Trevor Saunders bb_dict_test () ment to operate on the callers vector, not a copy of it. Otherwise it either does nothing or crashes. approved by Honza off list committing to trunk (bootstrapped + regtested x86_64-linux-gnu). Trev gcc/ChangeLog: 2015-02-18 Trevor Saunders * ipa-icf.c (sem_function::equals_private): Adjust. (sem_function::bb_dict_test): Take a vec * instead of auto_vec. * ipa-icf.h (bb_dict_test): Likewise. --- gcc/ChangeLog | 7 +++++++ gcc/ipa-icf.c | 16 ++++++++-------- gcc/ipa-icf.h | 2 +- 3 files changed, 16 insertions(+), 9 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 07cadb3..174e5b4 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2015-02-18 Trevor Saunders + + * ipa-icf.c (sem_function::equals_private): Adjust. + (sem_function::bb_dict_test): Take a vec * instead of + auto_vec. + * ipa-icf.h (bb_dict_test): Likewise. + 2015-02-18 Jakub Jelinek PR gcov-profile/64634 diff --git a/gcc/ipa-icf.c b/gcc/ipa-icf.c index 692946a..494fdcf 100644 --- a/gcc/ipa-icf.c +++ b/gcc/ipa-icf.c @@ -563,10 +563,10 @@ sem_function::equals_private (sem_item *item, if (e1->flags != e2->flags) return return_false_with_msg ("flags comparison returns false"); - if (!bb_dict_test (bb_dict, e1->src->index, e2->src->index)) + if (!bb_dict_test (&bb_dict, e1->src->index, e2->src->index)) return return_false_with_msg ("edge comparison returns false"); - if (!bb_dict_test (bb_dict, e1->dest->index, e2->dest->index)) + if (!bb_dict_test (&bb_dict, e1->dest->index, e2->dest->index)) return return_false_with_msg ("BB comparison returns false"); if (!m_checker->compare_edge (e1, e2)) @@ -1053,21 +1053,21 @@ sem_function::icf_handled_component_p (tree t) corresponds to TARGET. */ bool -sem_function::bb_dict_test (auto_vec bb_dict, int source, int target) +sem_function::bb_dict_test (vec *bb_dict, int source, int target) { source++; target++; - if (bb_dict.length () <= (unsigned)source) - bb_dict.safe_grow_cleared (source + 1); + if (bb_dict->length () <= (unsigned)source) + bb_dict->safe_grow_cleared (source + 1); - if (bb_dict[source] == 0) + if ((*bb_dict)[source] == 0) { - bb_dict[source] = target; + (*bb_dict)[source] = target; return true; } else - return bb_dict[source] == target; + return (*bb_dict)[source] == target; } /* Iterates all tree types in T1 and T2 and returns true if all types diff --git a/gcc/ipa-icf.h b/gcc/ipa-icf.h index adbedd6..a55699b 100644 --- a/gcc/ipa-icf.h +++ b/gcc/ipa-icf.h @@ -275,7 +275,7 @@ private: /* Basic blocks dictionary BB_DICT returns true if SOURCE index BB corresponds to TARGET. */ - bool bb_dict_test (auto_vec bb_dict, int source, int target); + bool bb_dict_test (vec *bb_dict, int source, int target); /* Iterates all tree types in T1 and T2 and returns true if all types are compatible. If COMPARE_POLYMORPHIC is set to true,