From patchwork Tue Sep 13 16:42:46 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Monakov X-Patchwork-Id: 114511 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 5482BB71CA for ; Wed, 14 Sep 2011 02:43:12 +1000 (EST) Received: (qmail 9906 invoked by alias); 13 Sep 2011 16:43:06 -0000 Received: (qmail 9897 invoked by uid 22791); 13 Sep 2011 16:43:04 -0000 X-SWARE-Spam-Status: No, hits=-2.0 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; Tue, 13 Sep 2011 16:42:49 +0000 Received: from ispserv.ispras.ru (ispserv.ispras.ru [83.149.198.72]) by smtp.ispras.ru (Postfix) with ESMTP id AA3255D4038; Tue, 13 Sep 2011 20:30:58 +0400 (MSD) Received: from monoid.intra.ispras.ru (winnie.ispras.ru [83.149.198.236]) by ispserv.ispras.ru (Postfix) with ESMTP id A09023FC48; Tue, 13 Sep 2011 20:42:46 +0400 (MSD) Date: Tue, 13 Sep 2011 20:42:46 +0400 (MSD) From: Alexander Monakov To: gcc-patches@gcc.gnu.org cc: "Vladimir N. Makarov" Subject: [PATCH] sel-sched: fix merging of LHS reg availability (PR 50340) Message-ID: User-Agent: Alpine 2.00 (LNX 1167 2008-08-23) MIME-Version: 1.0 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 Hello, This patches fixes an ICE on an assert that performs a sanity check on target_available field of expr_t, which is tri-state: LHS register is available (1), not available (0) or unknown (-1). The problem is, when merging expr data of separable exprs with differing LHSes, we can't claim we know anything about availability of the target register if the unavailable LHS of the other expr is not the same register. Thus, we should set the field to -1, not 0. Fixed as follows, bootstrapped and regtested on x86_64-linux and ia64-linux (without java, with one recent SRA patch reverted to unbreak bootstrap) with sel-sched enabled at -O2. OK for trunk? (a small testcase is not available at the moment, but I can try to produce one using delta before committing) 2011-09-13 Andrey Belevantsev * sel-sched-ir.c (update_target_availability): LHS register availability is not known if the unavailable LHS of the other expression is a different register. diff --git a/gcc/sel-sched-ir.c b/gcc/sel-sched-ir.c index 4878460..b132392 100644 --- a/gcc/sel-sched-ir.c +++ b/gcc/sel-sched-ir.c @@ -1746,7 +1746,13 @@ update_target_availability (expr_t to, expr_t from, insn_t split_point) EXPR_TARGET_AVAILABLE (to) = -1; } else - EXPR_TARGET_AVAILABLE (to) &= EXPR_TARGET_AVAILABLE (from); + if (EXPR_TARGET_AVAILABLE (from) == 0 + && EXPR_LHS (from) + && REG_P (EXPR_LHS (from)) + && REGNO (EXPR_LHS (to)) != REGNO (EXPR_LHS (from))) + EXPR_TARGET_AVAILABLE (to) = -1; + else + EXPR_TARGET_AVAILABLE (to) &= EXPR_TARGET_AVAILABLE (from); } }