From patchwork Wed Dec 16 12:51:53 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Biener X-Patchwork-Id: 557449 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 374041402A8 for ; Wed, 16 Dec 2015 23:52:11 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=V37/74br; 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 :mime-version:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; q=dns; s=default; b=SZSFX+a9ocR1XkaJNl REMJ+CWfJJOhV8kNkhITOEl4xjEFXlCEvIviXz25dZg+LsEUnqXSxuG+JEVSnu1r 82W1V7oMsPJsy6RiQYfnIUw59HL0i4ahuaeEdcDbBW2ji0AeE+T57yjvt5eKHJ04 bHmzgTjgZs6LgB1yt/+86rLiM= 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 :mime-version:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; s=default; bh=O/AQFDp/wz1d+PJMyparFArr g+g=; b=V37/74brvvGNXtpcv2J5q2rpP5/iSb/yyw80kaaSDfmAk4Tw6TogismV tbabL/wtibCT/fkYZJnVIrmwTp5pUF+e2dD/8dP/pasiijdv7YnqpVQLcvJ/dz9v KeBOt3j2YNS4RbZWROU7KPWj5fjT4akFdm9hdhtnJH4jD09aAS4= Received: (qmail 21060 invoked by alias); 16 Dec 2015 12:52:00 -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 20931 invoked by uid 89); 16 Dec 2015 12:51:59 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.4 required=5.0 tests=AWL, BAYES_05, FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-qk0-f174.google.com Received: from mail-qk0-f174.google.com (HELO mail-qk0-f174.google.com) (209.85.220.174) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Wed, 16 Dec 2015 12:51:56 +0000 Received: by mail-qk0-f174.google.com with SMTP id t125so61160193qkh.3 for ; Wed, 16 Dec 2015 04:51:56 -0800 (PST) MIME-Version: 1.0 X-Received: by 10.129.50.12 with SMTP id y12mr4441169ywy.305.1450270314012; Wed, 16 Dec 2015 04:51:54 -0800 (PST) Received: by 10.37.202.82 with HTTP; Wed, 16 Dec 2015 04:51:53 -0800 (PST) In-Reply-To: References: Date: Wed, 16 Dec 2015 13:51:53 +0100 Message-ID: Subject: Re: [PATCH PR68906] From: Richard Biener To: Yuri Rumyantsev Cc: gcc-patches , Igor Zamyatin X-IsSubscribed: yes On Wed, Dec 16, 2015 at 1:14 PM, Yuri Rumyantsev wrote: > Hi All, > > Here is simple patch which cures the issue with outer-loop unswitching > - added invocation of number_of_latch_executions() to reject > unswitching for non-iterated loops. > > Bootstrapping and regression testing did not show any new failures. > Is it OK for trunk? No, that looks like just papering over the issue. The issue (with the 2nd testcase at least) is that single_exit () accepts an exit from the inner loop. fixes the runtime testcase for me (not suitable for the testsuite due to the infinite looping though). Can you please bootstrap/test the above with your testcase? The above patch is ok if it passes testing (no time myself right now) Thanks, Richard. > ChangeLog: > > 2014-12-16 Yuri Rumyantsev > > PR tree-optimization/68906 > * tree-ssa-loop-unswitch.c : Include couple header files. > (tree_unswitch_outer_loop): Use number_of_latch_executions > to reject non-iterated loops. > > gcc/testsuite/ChangeLog > * gcc.dg/torture/pr68906.c: New test. Index: gcc/tree-ssa-loop-unswitch.c =================================================================== --- gcc/tree-ssa-loop-unswitch.c (revision 231686) +++ gcc/tree-ssa-loop-unswitch.c (working copy) @@ -431,7 +431,7 @@ tree_unswitch_outer_loop (struct loop *l return false; /* Accept loops with single exit only. */ exit = single_exit (loop); - if (!exit) + if (!exit || exit->src->loop_father != loop) return false; /* Check that phi argument of exit edge is not defined inside loop. */ if (!check_exit_phi (loop))