From patchwork Mon Nov 11 18:48:21 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Sandiford X-Patchwork-Id: 1193067 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-512991-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=arm.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="gb1x5roj"; dkim-atps=neutral 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 47BfzK38Ssz9sTf for ; Tue, 12 Nov 2019 05:48:45 +1100 (AEDT) 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=WjUBnQRREb8GGrQR6AIkwZ1u4WvG5 1o5PTK7QgWFMTQUsWX8EdkBEOSfmDJiTBkqn+o0bS7+QGiMF0sICJlGN4Aelc3nh l6AQbU52XfFgsukwIrG2WPYT6gGcDrgypg0UZpNQL4Md1XY67pVbLLZC4sKFXsyJ 1IIrbKXn1xECoI= 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=FKwQZSDh9qcrEzBVzkwQhxVOm8Y=; b=gb1 x5rojr/pgW34z/yZDYl3lIqzPIk3WL762Kpb9EeB/ffbnjLCUA7/zoOGCH3CvaZl 6Z8xPryepcg5+z2KpYrzkRK7KFTHN5j1qhPTWvA2zZ03t1PnwmF1PkiefwzW3umX /Tdxizbwhyf1VIts1lM6y0taE+5x7W0mNfuW2RCU= Received: (qmail 8935 invoked by alias); 11 Nov 2019 18:48:36 -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 8756 invoked by uid 89); 11 Nov 2019 18:48:26 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-11.8 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_ASCII_DIVIDERS, SPF_PASS autolearn=ham version=3.3.1 spammy= X-HELO: foss.arm.com Received: from foss.arm.com (HELO foss.arm.com) (217.140.110.172) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 11 Nov 2019 18:48:24 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id DC2D11FB for ; Mon, 11 Nov 2019 10:48:22 -0800 (PST) Received: from localhost (e121540-lin.manchester.arm.com [10.32.98.126]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 840033F52E for ; Mon, 11 Nov 2019 10:48:22 -0800 (PST) From: Richard Sandiford To: gcc-patches@gcc.gnu.org Mail-Followup-To: gcc-patches@gcc.gnu.org, richard.sandiford@arm.com Subject: [4/8] Record whether a dr_with_seg_len contains mixed steps References: Date: Mon, 11 Nov 2019 18:48:21 +0000 In-Reply-To: (Richard Sandiford's message of "Mon, 11 Nov 2019 18:45:00 +0000") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux) MIME-Version: 1.0 X-IsSubscribed: yes prune_runtime_alias_test_list can merge dr_with_seg_len_pair_ts that have different steps for the first reference or different steps for the second reference. This patch adds a flag to record that. I don't know whether the change to create_intersect_range_checks_index fixes anything in practice. It would have to be a corner case if so, since at present we only merge two alias pairs if either the first or the second references are identical and only the other references differ. And the vectoriser uses VF-based segment lengths only if both references in a pair have the same step. Either way, it still seems wrong to use DR_STEP when it doesn't represent all checks that have been merged into the pair. 2019-11-11 Richard Sandiford gcc/ * tree-data-ref.h (DR_ALIAS_MIXED_STEPS): New flag. * tree-data-ref.c (prune_runtime_alias_test_list): Set it when merging data references with different steps. (create_intersect_range_checks_index): Take a dr_with_seg_len_pair_t instead of two dr_with_seg_lens. Bail out if DR_ALIAS_MIXED_STEPS is set. (create_intersect_range_checks): Take a dr_with_seg_len_pair_t instead of two dr_with_seg_lens. Update call to create_intersect_range_checks_index. (create_runtime_alias_checks): Update call accordingly. Index: gcc/tree-data-ref.h =================================================================== --- gcc/tree-data-ref.h 2019-11-11 18:30:50.527193443 +0000 +++ gcc/tree-data-ref.h 2019-11-11 18:30:53.863170161 +0000 @@ -250,6 +250,12 @@ typedef struct data_reference *data_refe Temporary flags that indicate whether there is a pair P whose DRs have or haven't been swapped around. + DR_ALIAS_MIXED_STEPS: + The DR_STEP for one of the data references in the pair does not + accurately describe that reference for all members of P. (Note + that the flag does not say anything about whether the DR_STEPs + of the two references in the pair are the same.) + The ordering assumption mentioned above is that for every pair (DR_A, DR_B) in P: @@ -287,6 +293,7 @@ const unsigned int DR_ALIAS_WAW = 1U << const unsigned int DR_ALIAS_ARBITRARY = 1U << 3; const unsigned int DR_ALIAS_SWAPPED = 1U << 4; const unsigned int DR_ALIAS_UNSWAPPED = 1U << 5; +const unsigned int DR_ALIAS_MIXED_STEPS = 1U << 6; /* This struct contains two dr_with_seg_len objects with aliasing data refs. Two comparisons are generated from them. */ Index: gcc/tree-data-ref.c =================================================================== --- gcc/tree-data-ref.c 2019-11-11 18:30:50.527193443 +0000 +++ gcc/tree-data-ref.c 2019-11-11 18:30:53.863170161 +0000 @@ -1618,6 +1618,11 @@ prune_runtime_alias_test_list (vecdr), DR_STEP (dr_a2->dr), 0)) + alias_pair1->flags |= DR_ALIAS_MIXED_STEPS; + if (new_seg_len_p) { dr_a1->seg_len = build_int_cst (TREE_TYPE (dr_a1->seg_len), @@ -1663,11 +1668,14 @@ prune_runtime_alias_test_list (veclength (); i < s; ++i) + dr_with_seg_len_pair_t *alias_pair; + unsigned int i; + FOR_EACH_VEC_ELT (*alias_pairs, i, alias_pair) { - const dr_with_seg_len& dr_a = (*alias_pairs)[i].first; - const dr_with_seg_len& dr_b = (*alias_pairs)[i].second; - + gcc_assert (alias_pair->flags); if (dump_enabled_p ()) dump_printf (MSG_NOTE, "create runtime check for data references %T and %T\n", - DR_REF (dr_a.dr), DR_REF (dr_b.dr)); + DR_REF (alias_pair->first.dr), + DR_REF (alias_pair->second.dr)); /* Create condition expression for each pair data references. */ - create_intersect_range_checks (loop, &part_cond_expr, dr_a, dr_b); + create_intersect_range_checks (loop, &part_cond_expr, *alias_pair); if (*cond_expr) *cond_expr = fold_build2 (TRUTH_AND_EXPR, boolean_type_node, *cond_expr, part_cond_expr);