From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 97932 invoked by alias); 29 May 2019 15:58:04 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 97924 invoked by uid 89); 29 May 2019 15:58:03 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-1.8 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS autolearn=ham version=3.3.1 spammy= X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 29 May 2019 15:58:02 +0000 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id E1C518F90F; Wed, 29 May 2019 15:57:52 +0000 (UTC) Received: from localhost.localdomain (ovpn-112-2.rdu2.redhat.com [10.10.112.2]) by smtp.corp.redhat.com (Postfix) with ESMTP id E36985B681; Wed, 29 May 2019 15:57:51 +0000 (UTC) Subject: Re: [PATCH][RFC] final-value replacement from DCE To: Richard Biener , gcc-patches@gcc.gnu.org References: From: Jeff Law Openpgp: preference=signencrypt Message-ID: Date: Wed, 29 May 2019 15:58:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.4.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-IsSubscribed: yes X-SW-Source: 2019-05/txt/msg01931.txt.bz2 On 5/29/19 7:36 AM, Richard Biener wrote: > > The following tries to address PR90648 by performing final > value replacement from DCE when DCE knows the final value > computation is not used during loop iteration. This fits > neatly enough into existing tricks performed by DCE like > removing unused malloc/free pairs. DO you have the right BZ #? 90648 is a ICE in tree checking and doesn't have a loop :-) > > There's a few complications, one is it fails to bootstrap > because it exposes a few uninit warning false positives, > another is that -fno-tree-sccp is no longer effective. > As written this turns gcc.dg/pr34027-1.c into a division > again (I did not copy the expression_expensive checking). > It seems to also need -ftrapv adjustements (gcc.dg/pr81661.c). > > The goal of this patch is to remove the SCCP pass, or rather > us unconditionally replacing loop-closed PHIs with final > value computations which we've got complaints in the past > already that it duplicates computation that is readily > available. I've not yet figured testsuite fallout from that > change. > > For the -fno-tree-sccp I consider to simply honor that > flag in the DCE path, for the gcc.dg/pr34027-1.c I'll > re-install the expression_expensive checking. I'll > also fix the -ftrapv issue. > > Does this otherwise look a sensible way forward? > > Thanks, > Richard. > > FAIL: gcc.dg/builtin-object-size-1.c execution test > FAIL: gcc.dg/builtin-object-size-5.c scan-assembler-not abort > FAIL: gcc.dg/pr34027-1.c scan-tree-dump-times optimized " / " 0 > FAIL: gcc.dg/pr81661.c (internal compiler error) > FAIL: gcc.dg/pr81661.c (test for excess errors) > XPASS: gcc.dg/tree-ssa/loop-15.c scan-tree-dump-times optimized " \\\\+ " 0 > FAIL: gcc.dg/tree-ssa/loop-15.c scan-tree-dump-times optimized "if " 1 > FAIL: gcc.dg/tree-ssa/loop-26.c scan-tree-dump-times optimized "if" 2 > FAIL: gcc.dg/tree-ssa/pr32044.c scan-tree-dump-times optimized " / " 0 > FAIL: gcc.dg/tree-ssa/pr32044.c scan-tree-dump-times optimized "if" 6 > FAIL: gcc.dg/tree-ssa/pr64183.c scan-tree-dump cunroll "Loop 2 iterates at most 3 times" > FAIL: gcc.dg/tree-ssa/ssa-pre-3.c scan-tree-dump-times pre "Eliminated: 2" 1 > FAIL: gcc.dg/vect/no-scevccp-noreassoc-outer-3.c scan-tree-dump-times vect "OUTER LOOP VECTORIZED." 1 > FAIL: gcc.dg/vect/no-scevccp-noreassoc-outer-4.c scan-tree-dump-times vect "OUTER LOOP VECTORIZED." 1 > FAIL: gcc.dg/vect/no-scevccp-noreassoc-outer-5.c scan-tree-dump-times vect "OUTER LOOP VECTORIZED." 1 > FAIL: gcc.dg/vect/no-scevccp-outer-11.c scan-tree-dump-times vect "OUTER LOOP VECTORIZED." 1 > FAIL: gcc.dg/vect/no-scevccp-outer-13.c scan-tree-dump-times vect "OUTER LOOP VECTORIZED." 1 > FAIL: gcc.dg/vect/no-scevccp-outer-14.c scan-tree-dump-times vect "OUTER LOOP VECTORIZED." 1 > FAIL: gcc.dg/vect/no-scevccp-outer-15.c scan-tree-dump-times vect "OUTER LOOP VECTORIZED." 1 > FAIL: gcc.dg/vect/no-scevccp-outer-16.c scan-tree-dump-times vect "OUTER LOOP VECTORIZED." 1 > FAIL: gcc.dg/vect/no-scevccp-outer-17.c scan-tree-dump-times vect "OUTER LOOP VECTORIZED." 1 > FAIL: gcc.dg/vect/no-scevccp-outer-18.c scan-tree-dump-times vect "OUTER LOOP VECTORIZED." 1 > FAIL: gcc.dg/vect/no-scevccp-outer-19.c scan-tree-dump-times vect "OUTER LOOP VECTORIZED." 1 > FAIL: gcc.dg/vect/no-scevccp-outer-2.c scan-tree-dump-times vect "OUTER LOOP VECTORIZED" 1 > FAIL: gcc.dg/vect/no-scevccp-outer-20.c scan-tree-dump-times vect "OUTER LOOP VECTORIZED." 1 > FAIL: gcc.dg/vect/no-scevccp-outer-21.c scan-tree-dump-times vect "OUTER LOOP VECTORIZED." 1 > FAIL: gcc.dg/vect/no-scevccp-outer-3.c scan-tree-dump-times vect "OUTER LOOP VECTORIZED." 1 > FAIL: gcc.dg/vect/no-scevccp-outer-5.c scan-tree-dump-times vect "OUTER LOOP VECTORIZED." 1 > FAIL: gcc.dg/vect/no-scevccp-outer-6-global.c scan-tree-dump-times vect "OUTER LOOP VECTORIZED." 1 > FAIL: gcc.dg/vect/no-scevccp-outer-6.c scan-tree-dump-times vect "OUTER LOOP VECTORIZED." 1 > FAIL: gcc.dg/vect/no-scevccp-outer-7.c scan-tree-dump-times vect "OUTER LOOP VECTORIZED." 1 > FAIL: gcc.dg/vect/no-scevccp-outer-8.c scan-tree-dump-times vect "OUTER LOOP VECTORIZED." 1 > FAIL: gcc.dg/vect/no-scevccp-vect-iv-1.c scan-tree-dump-times vect "vectorized 1 loops" 1 > FAIL: gcc.dg/vect/no-scevccp-vect-iv-3.c scan-tree-dump-times vect "vect_recog_widen_sum_pattern: detected" 1 > FAIL: gcc.dg/vect/no-scevccp-vect-iv-3.c scan-tree-dump-times vect "vectorized 1 loops" 1 > > Running target unix//-m32 > FAIL: gcc.dg/builtin-object-size-1.c execution test > FAIL: gcc.dg/builtin-object-size-5.c scan-assembler-not abort > FAIL: gcc.dg/pr34027-1.c scan-tree-dump-times optimized " / " 0 > FAIL: gcc.dg/pr81661.c (internal compiler error) > FAIL: gcc.dg/pr81661.c (test for excess errors) > XPASS: gcc.dg/tree-ssa/loop-15.c scan-tree-dump-times optimized " \\\\+ " 0 > FAIL: gcc.dg/tree-ssa/loop-15.c scan-tree-dump-times optimized "if " 1 > FAIL: gcc.dg/tree-ssa/loop-26.c scan-tree-dump-times optimized "if" 2 > FAIL: gcc.dg/tree-ssa/pr32044.c scan-tree-dump-times optimized " / " 0 > FAIL: gcc.dg/tree-ssa/pr32044.c scan-tree-dump-times optimized "if" 6 > FAIL: gcc.dg/tree-ssa/pr64183.c scan-tree-dump cunroll "Loop 2 iterates at most 3 times" > FAIL: gcc.dg/tree-ssa/ssa-pre-3.c scan-tree-dump-times pre "Eliminated: 2" 1 > FAIL: gcc.dg/vect/no-scevccp-noreassoc-outer-3.c scan-tree-dump-times vect "OUTER LOOP VECTORIZED." 1 > FAIL: gcc.dg/vect/no-scevccp-noreassoc-outer-4.c scan-tree-dump-times vect "OUTER LOOP VECTORIZED." 1 > FAIL: gcc.dg/vect/no-scevccp-noreassoc-outer-5.c scan-tree-dump-times vect "OUTER LOOP VECTORIZED." 1 > FAIL: gcc.dg/vect/no-scevccp-outer-11.c scan-tree-dump-times vect "OUTER LOOP VECTORIZED." 1 > FAIL: gcc.dg/vect/no-scevccp-outer-13.c scan-tree-dump-times vect "OUTER LOOP VECTORIZED." 1 > FAIL: gcc.dg/vect/no-scevccp-outer-14.c scan-tree-dump-times vect "OUTER LOOP VECTORIZED." 1 > FAIL: gcc.dg/vect/no-scevccp-outer-15.c scan-tree-dump-times vect "OUTER LOOP VECTORIZED." 1 > FAIL: gcc.dg/vect/no-scevccp-outer-16.c scan-tree-dump-times vect "OUTER LOOP VECTORIZED." 1 > FAIL: gcc.dg/vect/no-scevccp-outer-17.c scan-tree-dump-times vect "OUTER LOOP VECTORIZED." 1 > FAIL: gcc.dg/vect/no-scevccp-outer-18.c scan-tree-dump-times vect "OUTER LOOP VECTORIZED." 1 > FAIL: gcc.dg/vect/no-scevccp-outer-19.c scan-tree-dump-times vect "OUTER LOOP VECTORIZED." 1 > FAIL: gcc.dg/vect/no-scevccp-outer-2.c scan-tree-dump-times vect "OUTER LOOP VECTORIZED" 1 > FAIL: gcc.dg/vect/no-scevccp-outer-20.c scan-tree-dump-times vect "OUTER LOOP VECTORIZED." 1 > FAIL: gcc.dg/vect/no-scevccp-outer-21.c scan-tree-dump-times vect "OUTER LOOP VECTORIZED." 1 > FAIL: gcc.dg/vect/no-scevccp-outer-3.c scan-tree-dump-times vect "OUTER LOOP VECTORIZED." 1 > FAIL: gcc.dg/vect/no-scevccp-outer-5.c scan-tree-dump-times vect "OUTER LOOP VECTORIZED." 1 > FAIL: gcc.dg/vect/no-scevccp-outer-6-global.c scan-tree-dump-times vect "OUTER LOOP VECTORIZED." 1 > FAIL: gcc.dg/vect/no-scevccp-outer-6.c scan-tree-dump-times vect "OUTER LOOP VECTORIZED." 1 > FAIL: gcc.dg/vect/no-scevccp-outer-7.c scan-tree-dump-times vect "OUTER LOOP VECTORIZED." 1 > FAIL: gcc.dg/vect/no-scevccp-outer-8.c scan-tree-dump-times vect "OUTER LOOP VECTORIZED." 1 > FAIL: gcc.dg/vect/no-scevccp-vect-iv-1.c scan-tree-dump-times vect "vectorized 1 loops" 1 > FAIL: gcc.dg/vect/no-scevccp-vect-iv-3.c scan-tree-dump-times vect "vect_recog_widen_sum_pattern: detected" 1 > FAIL: gcc.dg/vect/no-scevccp-vect-iv-3.c scan-tree-dump-times vect "vectorized 1 loops" 1 > FAIL: gcc.target/i386/pr85073.c scan-assembler-times test 1 > > 2019-05-29 Richard Biener > > PR tree-optimization/90594 > * tree-scalar-evolution.h (final_value_replacement): Declare. > * tree-scalar-evolution.c (final_value_replacement): Split out > worker on one PHI from ... > (final_value_replacement_loop): ... here. > * gimple-fold.h (rewrite_seq_to_defined_overflow): Declare. > * gimple-fold.c (rewrite_seq_to_defined_overflow): Wrap > around rewrite_to_defined_overflow to handle a whole sequence. > * tree-ssa-dce.c (lcphi_map): New. > (mark_operands_necessary): New walk_tree worker. > (propagate_necessity): Elide defs of LC PHIs we can perform value > replacement on. > (remove_dead_phis): Perform value replacement on LC PHIs that > had their def removed. > (perform_tree_ssa_dce): Go into LC SSA in aggressive mode. > Precompute final value replacements. > > * gcc.dg/tree-ssa/loop-14.c: Adjust for new expected place > for transform. The approach here looks quite reasonable to me, so it's just a matter of the fallout, as are so many things these days... jeff