From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 34355 invoked by alias); 14 Jul 2015 11:07:01 -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 34346 invoked by uid 89); 14 Jul 2015 11:07:00 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.0 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-ob0-f180.google.com Received: from mail-ob0-f180.google.com (HELO mail-ob0-f180.google.com) (209.85.214.180) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Tue, 14 Jul 2015 11:06:59 +0000 Received: by obnw1 with SMTP id w1so3704167obn.3 for ; Tue, 14 Jul 2015 04:06:57 -0700 (PDT) MIME-Version: 1.0 X-Received: by 10.182.186.2 with SMTP id fg2mr36321877obc.35.1436872017333; Tue, 14 Jul 2015 04:06:57 -0700 (PDT) Received: by 10.76.115.167 with HTTP; Tue, 14 Jul 2015 04:06:57 -0700 (PDT) In-Reply-To: References: Date: Tue, 14 Jul 2015 11:07:00 -0000 Message-ID: Subject: Re: [PATCH] Unswitching outer loops. From: Richard Biener To: Yuri Rumyantsev Cc: gcc-patches , Igor Zamyatin Content-Type: text/plain; charset=UTF-8 X-IsSubscribed: yes X-SW-Source: 2015-07/txt/msg01135.txt.bz2 On Fri, Jul 10, 2015 at 12:02 PM, Yuri Rumyantsev wrote: > Hi All, > > Here is presented simple transformation which tries to hoist out of > outer-loop a check on zero trip count for inner-loop. This is very > restricted transformation since it accepts outer-loops with very > simple cfg, as for example: > acc = 0; > for (i = 1; i <= m; i++) { > for (j = 0; j < n; j++) > if (l[j] == i) { v[j] = acc; acc++; }; > acc <<= 1; > } > > Note that degenerative outer loop (without inner loop) will be > completely deleted as dead code. > The main goal of this transformation was to convert outer-loop to form > accepted by outer-loop vectorization (such test-case is also included > to patch). > > Bootstrap and regression testing did not show any new failures. > > Is it OK for trunk? I think this is https://gcc.gnu.org/bugzilla/show_bug.cgi?id=23855 as well. It has a patch adding a invariant loop guard hoisting phase to loop-header copying. Yeah, it needs updating to trunk again I suppose. It's always non-stage1 when I come back to that patch. Your patch seems to be very specific and only handles outer loops of innermost loops. Richard. > ChangeLog: > 2015-07-10 Yuri Rumyantsev > > * tree-ssa-loop-unswitch.c: Include "tree-cfgcleanup.h" and > "gimple-iterator.h", add prototype for tree_unswitch_outer_loop. > (tree_ssa_unswitch_loops): Add invoke of tree_unswitch_outer_loop. > (tree_unswitch_outer_loop): New function. > > gcc/testsuite/ChangeLog: > * gcc.dg/tree-ssa/unswitch-outer-loop-1.c: New test. > * gcc.dg/vect/vect-outer-simd-3.c: New test.