From patchwork Mon Mar 14 09:31:24 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrey Belevantsev X-Patchwork-Id: 596980 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 3qNswH4PBJz9s3T for ; Mon, 14 Mar 2016 20:32:14 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=bdIu2cmT; 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 :subject:to:references:cc:from:message-id:date:mime-version :in-reply-to:content-type; q=dns; s=default; b=kMssviveGw9nMVje0 EIhBR8l2A5MbZOFmk/E+QIEvNVGFnIHdQ59U0ow8oS1jf0eKPHQYmbdqLdWXsDiX 4mi9tEkMs6PzSal+1rTUAE8BTBx+Q5RgxKWXZvy1GuxLFiRAWVQTOUJ1P7YcJbff /vc9Ur1YOoYdhdgZBG0ZEVb/YQ= 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 :subject:to:references:cc:from:message-id:date:mime-version :in-reply-to:content-type; s=default; bh=ZwiDjRP+eq8OXRETsYUBKH6 KSAI=; b=bdIu2cmTBsQ9YNFMhue7jwvvIW62ech++MSK9YQl+i89VT4DpdF0fp0 Us7cgfXYpS6niWAapFC8mqM+cEmuORqqSgwzDFywuZM7z0XwKJ2FlnCGEAC7OC9V fOLL/xGEVc8JBdf2HynXD3LTFyMbGATYEpDZMwZVHe1xLMjlyuFM= Received: (qmail 55426 invoked by alias); 14 Mar 2016 09:32:01 -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 55382 invoked by uid 89); 14 Mar 2016 09:32:00 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.1 required=5.0 tests=AWL, BAYES_00, KAM_LAZY_DOMAIN_SECURITY, RP_MATCHES_RCVD autolearn=no version=3.3.2 spammy=1, 12, fence, powerpc***, spoil X-HELO: mail.ispras.ru Received: from mail.ispras.ru (HELO mail.ispras.ru) (83.149.199.45) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 14 Mar 2016 09:31:50 +0000 Received: from [10.10.3.52] (pluton2.ispras.ru [83.149.199.44]) by mail.ispras.ru (Postfix) with ESMTPSA id 5347D54007B; Mon, 14 Mar 2016 12:31:48 +0300 (MSK) Subject: [02/05] Fix PR 63384 To: GCC Patches References: Cc: Alexander Monakov From: Andrey Belevantsev Message-ID: <693a88a9-8878-b169-2bcf-f35e3b52c859@ispras.ru> Date: Mon, 14 Mar 2016 12:31:24 +0300 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.0 MIME-Version: 1.0 In-Reply-To: X-IsSubscribed: yes Hello, Here we're looping because we decrease the counter of the insns we still can issue on a DEBUG_INSN thus rendering the counter negative. The fix is to not count debug insns in the corresponding code. The selective scheduling is known to spoil the result of var tracking, but still it is not the reason to hang in there. The toggle option used in the test seems to be the equivalent of just enabling var-tracking-assignments which should lead to the same situation; however, if specified as is, var-tracking-assignments will be disabled by the toplev.c:1460 code. Maybe we also need the same treatment for flag_var_tracking_assignments_toggle. Ok for trunk? gcc/ 2016-03-14 Andrey Belevantsev PR rtl-optimization/63384 * sel-sched.c (invoke_aftermath_hooks): Do not decrease issue_more on DEBUG_INSN_P insns. testsuite/ 2016-03-14 Andrey Belevantsev PR rtl-optimization/63384 * testsuite/g++.dg/pr63384.C: New test. Best, Andrey diff --git a/gcc/sel-sched.c b/gcc/sel-sched.c index c798935..893a3e5 100644 --- a/gcc/sel-sched.c +++ b/gcc/sel-sched.c @@ -4249,7 +4249,8 @@ invoke_aftermath_hooks (fence_t fence, rtx_insn *best_insn, int issue_more) issue_more); memcpy (FENCE_STATE (fence), curr_state, dfa_state_size); } - else if (GET_CODE (PATTERN (best_insn)) != USE + else if (! DEBUG_INSN_P (best_insn) + && GET_CODE (PATTERN (best_insn)) != USE && GET_CODE (PATTERN (best_insn)) != CLOBBER) issue_more--; diff --git a/gcc/testsuite/g++.dg/pr63384.C b/gcc/testsuite/g++.dg/pr63384.C new file mode 100644 index 0000000..b4e0784 --- /dev/null +++ b/gcc/testsuite/g++.dg/pr63384.C @@ -0,0 +1,12 @@ +/* { dg-do compile { target powerpc*-*-* ia64-*-* i?86-*-* x86_64-*-* } } */ +/* { dg-options "-O2 -fselective-scheduling2 -fsel-sched-pipelining -fsel-sched-pipelining-outer-loops -fsel-sched-reschedule-pipelined -fvar-tracking-assignments-toggle -ftree-vectorize" } */ + +template T **make_test_matrix() { + T **data = new T *; + for (int i = 0; i < 1000; i++) + ; +} + +template void test() { T **c = make_test_matrix(); } + +main() { test(); }