From patchwork Sun Aug 3 13:59:31 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Sandiford X-Patchwork-Id: 376023 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 4C10B140085 for ; Sun, 3 Aug 2014 23:59:44 +1000 (EST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:subject:references:date:in-reply-to:message-id:mime-version :content-type; q=dns; s=default; b=LA5Lei5L5H/CPlZca6zi4dX8HzHY3 +1mHCNloS1r6r68SJTD0TOYa1DRoZzXyB+yd+Xec2FdPoN1BDRVDr8YxlBFRYBh2 mcRYZA1naRpuFWs7Lf8nUjAYn0nl/tMRjHk87T3P8H93Hv5UuK1/sefxKeiufJb7 IoKgEaN3FaxqQ0= 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:from :to:subject:references:date:in-reply-to:message-id:mime-version :content-type; s=default; bh=WcZf03hQe2+6Px8Zcd92DJEGqKM=; b=CwT anqAWJqlS4JbeV7wcu46K2xrSos4pK6xPuJjgWbLzcdCxafuFTossQktsxXnBr62 ZzCYF4DYkCmdOLNkZmirwuigrn0ajsrZbWJx2r4OqW9t1MWfseRnLY/JANn+1cvG t2ta9j0Ifc1PTfffA+9WuohATiqWn4/CsglZXAME= Received: (qmail 26745 invoked by alias); 3 Aug 2014 13:59:37 -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 26730 invoked by uid 89); 3 Aug 2014 13:59:36 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.5 required=5.0 tests=AWL, BAYES_00, FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-we0-f172.google.com Received: from mail-we0-f172.google.com (HELO mail-we0-f172.google.com) (74.125.82.172) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Sun, 03 Aug 2014 13:59:35 +0000 Received: by mail-we0-f172.google.com with SMTP id x48so6443403wes.17 for ; Sun, 03 Aug 2014 06:59:32 -0700 (PDT) X-Received: by 10.180.187.7 with SMTP id fo7mr21722931wic.4.1407074372754; Sun, 03 Aug 2014 06:59:32 -0700 (PDT) Received: from localhost ([95.145.138.172]) by mx.google.com with ESMTPSA id wd7sm36021706wjc.36.2014.08.03.06.59.32 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 03 Aug 2014 06:59:32 -0700 (PDT) From: Richard Sandiford To: gcc-patches@gcc.gnu.org Mail-Followup-To: gcc-patches@gcc.gnu.org, rdsandiford@googlemail.com Subject: [PATCH 16/50] ddg.c:insns_may_alias_p References: <87y4v5d77q.fsf@googlemail.com> Date: Sun, 03 Aug 2014 14:59:31 +0100 In-Reply-To: <87y4v5d77q.fsf@googlemail.com> (Richard Sandiford's message of "Sun, 03 Aug 2014 14:38:01 +0100") Message-ID: <871tsxbrng.fsf@googlemail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) MIME-Version: 1.0 gcc/ * ddg.c (walk_mems_2, walk_mems_1): Delete. (insns_may_alias_p): Use FOR_EACH_SUBRTX rather than for_each_rtx to iterate over subrtxes. Return a bool rather than an int. Index: gcc/ddg.c =================================================================== --- gcc/ddg.c 2014-08-03 11:25:24.327096689 +0100 +++ gcc/ddg.c 2014-08-03 11:25:24.650099882 +0100 @@ -397,41 +397,25 @@ build_inter_loop_deps (ddg_ptr g) } -static int -walk_mems_2 (rtx *x, rtx mem) -{ - if (MEM_P (*x)) - { - if (may_alias_p (*x, mem)) - return 1; - - return -1; - } - return 0; -} - -static int -walk_mems_1 (rtx *x, rtx *pat) +/* Return true if two specified instructions have mem expr with conflict + alias sets. */ +static bool +insns_may_alias_p (rtx insn1, rtx insn2) { - if (MEM_P (*x)) + subrtx_iterator::array_type array1; + subrtx_iterator::array_type array2; + FOR_EACH_SUBRTX (iter1, array1, PATTERN (insn1), NONCONST) { - /* Visit all MEMs in *PAT and check independence. */ - if (for_each_rtx (pat, (rtx_function) walk_mems_2, *x)) - /* Indicate that dependence was determined and stop traversal. */ - return 1; - - return -1; + const_rtx x1 = *iter1; + if (MEM_P (x1)) + FOR_EACH_SUBRTX (iter2, array2, PATTERN (insn2), NONCONST) + { + const_rtx x2 = *iter2; + if (MEM_P (x2) && may_alias_p (x2, x1)) + return true; + } } - return 0; -} - -/* Return 1 if two specified instructions have mem expr with conflict alias sets*/ -static int -insns_may_alias_p (rtx insn1, rtx insn2) -{ - /* For each pair of MEMs in INSN1 and INSN2 check their independence. */ - return for_each_rtx (&PATTERN (insn1), (rtx_function) walk_mems_1, - &PATTERN (insn2)); + return false; } /* Given two nodes, analyze their RTL insns and add intra-loop mem deps