From patchwork Mon Apr 18 17:24:48 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Hubicka X-Patchwork-Id: 611821 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 3qpZlx0cqwz9t3f for ; Tue, 19 Apr 2016 03:25:16 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=Y4nmQ8kL; 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:date :from:to:subject:message-id:mime-version:content-type; q=dns; s= default; b=gWpIqgCTPvf6j43+vK3QxGEUiEh7xxhYUIqrwdfz+n0Rc31ZRSgzr PJ7ftj3vuUdgi1zVh4mxeirAY6s5n/XTWQG+VAmU7KLDqTjZhwfLLilEKsqzw/zM 1SNTAAlhJFEH+mjBd9wn60aj/6N5ZnSSnDKckg19eE2V7JMoJ/+H60= 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:date :from:to:subject:message-id:mime-version:content-type; s= default; bh=fqwrELkFsvBs+LWnycitj3aD628=; b=Y4nmQ8kL1191JxfS/iUo e71/cUppMey9HA57+v1qrnC2mv6684NTThGEs4V8mAtvSaXwOHAj6UWISTTZT+SY UhXrfguIsehIQN4I/EavYsy3zSJu60YdFVPAOLCqLGx9/mPvhB2b3JsMRE8h9RTf qBvS0XMO7X/5ZopDpX1ltHU= Received: (qmail 60204 invoked by alias); 18 Apr 2016 17:25:08 -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 60192 invoked by uid 89); 18 Apr 2016 17:25:07 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.8 required=5.0 tests=AWL, BAYES_00, KAM_ASCII_DIVIDERS, KAM_LAZY_DOMAIN_SECURITY, RP_MATCHES_RCVD autolearn=no version=3.3.2 spammy=realistic, sk:estimat, fallout X-HELO: nikam.ms.mff.cuni.cz Received: from nikam.ms.mff.cuni.cz (HELO nikam.ms.mff.cuni.cz) (195.113.20.16) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Mon, 18 Apr 2016 17:24:52 +0000 Received: by nikam.ms.mff.cuni.cz (Postfix, from userid 16202) id 6F490540A1A; Mon, 18 Apr 2016 19:24:48 +0200 (CEST) Date: Mon, 18 Apr 2016 19:24:48 +0200 From: Jan Hubicka To: gcc-patches@gcc.gnu.org Subject: Re-apply reverted niter change 1/4 Message-ID: <20160418172448.GA83672@kam.mff.cuni.cz> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) Hi, as discussed on IRC today, I would like to re-apply the patch to fix bogus realistic bounds in niter. As it turned out, we seem to rely on this bogus estimate in few benchmarks and there is miscompilation with avx512. The performance regressions should be solved my planned patch to introduce likely upper bounds - here we can track the assumption that there are no trailing arrays in the structures. I plan to send it after some benchmarking. Moreover we can get smarter about tracking trailing arrays. We seem to get wrong MEM_REFs (as noticed by Richard), we may disable the path for non-C based languages (regresions are for Fortran testcases) and we can track object sizes. I plan to do that step-by-step so possible additional fallout is easier to track. This patch re-instantiate first fix included in the orignial patch - ivopts should consider max_stmt-executions_int when giving an estimate on number of iterations. Bootstrapped/regtested x86_64-linux, comitted. Honza Index: ChangeLog =================================================================== --- ChangeLog (revision 235157) +++ ChangeLog (working copy) @@ -1,3 +1,8 @@ +2016-04-17 Jan Hubicka + + * tree-ssa-loop-ivopts.c (avg_loop_niter): Use also + max_loop_iterations_int. + 2016-04-18 Richard Biener PR tree-optimization/43434 Index: tree-ssa-loop-ivopts.c =================================================================== --- tree-ssa-loop-ivopts.c (revision 235064) +++ tree-ssa-loop-ivopts.c (working copy) @@ -121,7 +121,11 @@ avg_loop_niter (struct loop *loop) { HOST_WIDE_INT niter = estimated_stmt_executions_int (loop); if (niter == -1) - return AVG_LOOP_NITER (loop); + { + niter = max_stmt_executions_int (loop); + if (niter == -1 || niter > AVG_LOOP_NITER (loop)) + return AVG_LOOP_NITER (loop); + } return niter; }