From patchwork Wed Aug 3 15:30:31 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Monakov X-Patchwork-Id: 108277 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 0DBC7B71E2 for ; Thu, 4 Aug 2011 01:31:00 +1000 (EST) Received: (qmail 11330 invoked by alias); 3 Aug 2011 15:30:55 -0000 Received: (qmail 11310 invoked by uid 22791); 3 Aug 2011 15:30:54 -0000 X-SWARE-Spam-Status: No, hits=-2.1 required=5.0 tests=AWL, BAYES_00, RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from smtp.ispras.ru (HELO smtp.ispras.ru) (83.149.198.202) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 03 Aug 2011 15:30:39 +0000 Received: from condor.intra.ispras.ru (winnie.ispras.ru [83.149.198.236]) by smtp.ispras.ru (Postfix) with ESMTP id 583B85D4042; Wed, 3 Aug 2011 19:21:47 +0400 (MSD) Received: by condor.intra.ispras.ru (Postfix, from userid 23246) id 5792512205EF; Wed, 3 Aug 2011 19:30:38 +0400 (MSD) From: Alexander Monakov To: gcc-patches@gcc.gnu.org Cc: vmakarov@redhat.com Subject: [PATCH 1/8] Take maximum spec when merging exprs Date: Wed, 3 Aug 2011 19:30:31 +0400 Message-Id: <1312385438-6273-2-git-send-email-amonakov@ispras.ru> In-Reply-To: <1312385438-6273-1-git-send-email-amonakov@ispras.ru> References: <1312385438-6273-1-git-send-email-amonakov@ispras.ru> To: gcc-patches@gcc.gnu.org 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 From: Dmitry Melnik EXPR_SPEC is an indicator of the speculativeness of an expression (an instruction or just an rhs), as it is incremented each time the expression is moved up across a conditional branch. When merging expr attributes for similar exprs available from two destinations of a branch, sel-sched assigns the minimum of EXPR_SPEC's to the result, effectively making the resulting expr non-speculative if only one of those exprs was non-speculative. However, since we are relying on EXPR_SPEC being a correct indication of expr's speculativeness when deciding whether it would need a bookkeeping copy, we really want to avoid that. The patch changes minimum to maximum, making the code match what was originally intended. 2011-08-04 Dmitry Melnik * sel-sched-ir.c (merge_expr_data): Take maximum spec. diff --git a/gcc/sel-sched-ir.c b/gcc/sel-sched-ir.c index de7629a..5a287d0 100644 --- a/gcc/sel-sched-ir.c +++ b/gcc/sel-sched-ir.c @@ -1810,9 +1810,9 @@ update_speculative_bits (expr_t to, expr_t from, insn_t split_point) void merge_expr_data (expr_t to, expr_t from, insn_t split_point) { - /* For now, we just set the spec of resulting expr to be minimum of the specs - of merged exprs. */ - if (EXPR_SPEC (to) > EXPR_SPEC (from)) + /* Choose the maximum of the specs of merged exprs. This is required + for correctness of bookkeeping. */ + if (EXPR_SPEC (to) < EXPR_SPEC (from)) EXPR_SPEC (to) = EXPR_SPEC (from); if (split_point)