From patchwork Mon Apr 10 09:02:40 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Biener X-Patchwork-Id: 748895 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 3w1kjY2M6sz9sNH for ; Mon, 10 Apr 2017 19:02:56 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="g74ywu5G"; 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=Q2DkeG+rYQ3XP2iQ2Fzh6hzL0mkvCDKnvN8cKN9OG16YPoEeQdYXl ZrnS+BSmpEzuJu+Uy6Tyzc/LNghPY90kb//pW4LaErZU6LolEK1V3aFsjiu8W6M/ vrVhbWYb8XL32u2HZgRQKlKCs/9rNGOEq+VGxt8dTkALK0p3AHkgYA= 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=BPeLTBw/xCNhFd9NPtbzkzwi2dI=; b=g74ywu5GOO8fkqjlk+yb koBQ+WFsGtNFkauudeHRZbFaBu8ohtg1pcgjyyJcIcBvCqq1xJE0/B9l/0UOFo4M NJ/T8+O0QUHDy+bz6FHYcJZwciVSSM2WZodZwgqPqZV/74aBHcaGC1jPvefaEunx Z8Fxp+G+9RLnIUsm9t5FIe4= Received: (qmail 63673 invoked by alias); 10 Apr 2017 09:02:44 -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 62577 invoked by uid 89); 10 Apr 2017 09:02:42 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-11.9 required=5.0 tests=BAYES_00, GIT_PATCH_2, GIT_PATCH_3, RP_MATCHES_RCVD, SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: mx2.suse.de Received: from mx2.suse.de (HELO mx2.suse.de) (195.135.220.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 10 Apr 2017 09:02:41 +0000 Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id DD40CAC44 for ; Mon, 10 Apr 2017 09:02:40 +0000 (UTC) Date: Mon, 10 Apr 2017 11:02:40 +0200 (CEST) From: Richard Biener To: gcc-patches@gcc.gnu.org Subject: [PATCH] Fix PR80304 Message-ID: User-Agent: Alpine 2.20 (LSU 67 2015-01-07) MIME-Version: 1.0 The following fixes a fortran testcase involving safelen where store motion needs to be disabled for unanalyzable refs (we don't know how to transform them). But the safelen case missed to recurse (because that's only necessary for unanalyzable mems). Bootstrap / regtest on x86_64-unknown-linux-gnu. I'll try to come up with a testcase later. Richard. 2017-04-10 Richard Biener PR tree-optimization/80304 * tree-ssa-loop-im.c (ref_indep_loop_p_1): Also recurse for safelen. Index: gcc/tree-ssa-loop-im.c =================================================================== --- gcc/tree-ssa-loop-im.c (revision 246797) +++ gcc/tree-ssa-loop-im.c (working copy) @@ -2145,9 +2145,21 @@ ref_indep_loop_p_1 (int safelen, struct fprintf (dump_file, "\n"); } + /* We need to recurse to properly handle UNANALYZABLE_MEM_ID. */ + struct loop *inner = loop->inner; + while (inner) + { + if (!ref_indep_loop_p_1 (safelen, inner, ref, stored_p, ref_loop)) + { + indep_p = false; + break; + } + inner = inner->next; + } + /* Avoid caching here as safelen depends on context and refs are shared between different contexts. */ - return true; + return indep_p; } else {