From patchwork Thu Oct 12 14:29:16 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Biener X-Patchwork-Id: 824899 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-464035-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="M75TQt1S"; 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 3yCYBz1mv7z9s76 for ; Fri, 13 Oct 2017 01:29:27 +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:date :from:to:cc:subject:message-id:mime-version:content-type; q=dns; s=default; b=EJUU7ljRnB+tO4f2PmxPwp286EPjC6Mkg7KbFhX3jB6ahGEIky nNXfNLaxPsJHSDAQN8vMnCwwNNJjOr+q3COatoSSsncOaiebtmx5OEg/U4b8WVL1 YqVc5erzIHoWObiqKYMI0qPTKVfrJ5z0EjBc+O8Vw10+kH8DkWOg+oQuk= 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:cc:subject:message-id:mime-version:content-type; s= default; bh=c1u4dY02BkB9+Q2Wl5yWYYLdDHI=; b=M75TQt1SHEVLpsx9GqQf dh/06jFtOWSLZfgyt2n3AgVWXDLXj6LYEuBy4Kij8bgKSOazqOMASNm3POOZE6vf bJcuytAKRV4PtOPOFjB+W/3tJfnl7DCfRD3w3fI3klVENoLNQAFaWwhB1cCtJAOh uREZAGkNzivlWVAL4cFHmik= Received: (qmail 113860 invoked by alias); 12 Oct 2017 14:29:20 -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 113846 invoked by uid 89); 12 Oct 2017 14:29:19 -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=lift, Lift, H*c:HHHH 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; Thu, 12 Oct 2017 14:29:18 +0000 Received: from relay2.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 59251ABCA; Thu, 12 Oct 2017 14:29:16 +0000 (UTC) Date: Thu, 12 Oct 2017 16:29:16 +0200 (CEST) From: Richard Biener To: gcc-patches@gcc.gnu.org cc: sebpop@gmail.com Subject: [PATCH][GRAPHITE] Lift some IV restrictions Message-ID: User-Agent: Alpine 2.20 (LSU 67 2015-01-07) MIME-Version: 1.0 The type check seems premature (we're checking CHRECs already) and we certainly can handle POINTER IVs just fine. Bootstrap / regtest running on x86_64-unknown-linux-gnu. SPEC CPU 2k6 sees ~100 more loop nest optimizations that way. Ok? [I'd rather have problematical testcases for those weird restrictions] Thanks, Richard. 2017-10-12 Richard Biener * graphite-scop-detection.c (loop_ivs_can_be_represented): Remove. (scop_detection::harmful_loop_in_region): Remove premature IV type restriction. (scop_detection::graphite_can_represent_scev): We can handle pointer IVs just fine. Index: gcc/graphite-scop-detection.c =================================================================== --- gcc/graphite-scop-detection.c (revision 253676) +++ gcc/graphite-scop-detection.c (working copy) @@ -254,28 +254,6 @@ dot_cfg () scops.release (); } -/* Can all ivs be represented by a signed integer? - As isl might generate negative values in its expressions, signed loop ivs - are required in the backend. */ - -static bool -loop_ivs_can_be_represented (loop_p loop) -{ - unsigned type_long_long = TYPE_PRECISION (long_long_integer_type_node); - for (gphi_iterator psi = gsi_start_phis (loop->header); !gsi_end_p (psi); - gsi_next (&psi)) - { - gphi *phi = psi.phi (); - tree res = PHI_RESULT (phi); - tree type = TREE_TYPE (res); - - if (TYPE_UNSIGNED (type) && TYPE_PRECISION (type) >= type_long_long) - return false; - } - - return true; -} - /* Returns a COND_EXPR statement when BB has a single predecessor, the edge between BB and its predecessor is not a loop exit edge, and the last statement of the single predecessor is a COND_EXPR. */ @@ -822,13 +800,6 @@ scop_detection::harmful_loop_in_region ( return true; } - if (! loop_ivs_can_be_represented (loop)) - { - DEBUG_PRINT (dp << "[scop-detection-fail] loop_" << loop->num - << "IV cannot be represented.\n"); - return true; - } - /* Check if all loop nests have at least one data reference. ??? This check is expensive and loops premature at this point. If important to retain we can pre-compute this for all innermost @@ -968,14 +939,6 @@ scop_detection::graphite_can_represent_s if (chrec_contains_undetermined (scev)) return false; - /* We disable the handling of pointer types, because it’s currently not - supported by Graphite with the isl AST generator. SSA_NAME nodes are - the only nodes, which are disabled in case they are pointers to object - types, but this can be changed. */ - - if (POINTER_TYPE_P (TREE_TYPE (scev)) && TREE_CODE (scev) == SSA_NAME) - return false; - switch (TREE_CODE (scev)) { case NEGATE_EXPR: