From patchwork Thu Sep 21 09:44:32 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Biener X-Patchwork-Id: 816792 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-462680-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="GLQskwyW"; 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 3xyWt470RFz9t49 for ; Thu, 21 Sep 2017 19:44:44 +1000 (AEST) 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=FwhPWaPeStambfckYpaY6XF1fbNf+vRPCMYQL3LXIUCyOXqCFNQA5 ieQ03qPoLhTfmJIIIELoxipcEgVgcN5MQxsy5R5/omwEU9SdArPUX2zO7XHbNpBY 5noKNBYMlbmx2x7oGUNNEbanudAI9dw6izxx5UAVWpbDKo87/+349g= 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=ZY55LPvb5ZGknAt2cTJifEKAjx4=; b=GLQskwyW+bsQlBv7x+4j r4fo1tlVRIE6aBljwu3oiLn1RbOjO1eOmKEgNG73AHgHxNwejmtGDtiOAlV4h9DQ TwtIq0cT5Mmnf2LgLxXvkyWWqH57XYqSjhoTt4hnVNXO5ls5LdQMg3DJ9GXD3ONe 9mSsVsZ/3BgLTlsfUQ8edhs= Received: (qmail 105669 invoked by alias); 21 Sep 2017 09:44: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 105656 invoked by uid 89); 21 Sep 2017 09:44:35 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-11.1 required=5.0 tests=BAYES_00, GIT_PATCH_2, GIT_PATCH_3, KAM_ASCII_DIVIDERS, RP_MATCHES_RCVD, SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: mx1.suse.de Received: from mx2.suse.de (HELO mx1.suse.de) (195.135.220.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 21 Sep 2017 09:44:34 +0000 Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 96800AAEF for ; Thu, 21 Sep 2017 09:44:32 +0000 (UTC) Date: Thu, 21 Sep 2017 11:44:32 +0200 (CEST) From: Richard Biener To: gcc-patches@gcc.gnu.org Subject: [PATCH][GRAPHITE] Fix IL after codegen errors Message-ID: User-Agent: Alpine 2.20 (LSU 67 2015-01-07) MIME-Version: 1.0 The following fixes the IL after code generation errors so we can continue processing SCOPs. This increases the number of transformed loop nests in SPEC CPU 2006 by 50%. Bootstrap and regtest running on x86_64-unknown-linux-gnu. Richard. 2017-09-21 Richard Biener * graphite-isl-ast-to-gimple.c (graphite_regenerate_ast_isl): Restore valid IL after code generation errors. * graphite.c (graphite_transform_loops): Diagnose code generation issues as MSG_MISSED_OPTIMIZATION and continue with processing SCOPs. Index: gcc/graphite-isl-ast-to-gimple.c =================================================================== --- gcc/graphite-isl-ast-to-gimple.c (revision 253050) +++ gcc/graphite-isl-ast-to-gimple.c (working copy) @@ -3068,6 +3068,26 @@ graphite_regenerate_ast_isl (scop_p scop } } + if (t.codegen_error_p ()) + { + /* We registered new names, scrap that. */ + if (need_ssa_update_p (cfun)) + delete_update_ssa (); + /* Remove the unreachable region. */ + remove_edge_and_dominated_blocks (if_region->true_region->region.entry); + basic_block ifb = if_region->false_region->region.entry->src; + gimple_stmt_iterator gsi = gsi_last_bb (ifb); + gsi_remove (&gsi, true); + if_region->false_region->region.entry->flags &= ~EDGE_FALSE_VALUE; + if_region->false_region->region.entry->flags |= EDGE_FALLTHRU; + /* remove_edge_and_dominated_blocks marks loops for removal but + doesn't actually remove them (fix that...). */ + loop_p loop; + FOR_EACH_LOOP (loop, LI_FROM_INNERMOST) + if (! loop->header) + delete_loop (loop); + } + free (if_region->true_region); free (if_region->region); free (if_region); Index: gcc/graphite.c =================================================================== --- gcc/graphite.c (revision 253050) +++ gcc/graphite.c (working copy) @@ -337,17 +337,16 @@ graphite_transform_loops (void) if (!apply_poly_transforms (scop)) continue; + location_t loc = find_loop_location + (scops[i]->scop_info->region.entry->dest->loop_father); + need_cfg_cleanup_p = true; - /* When code generation is not successful, do not continue - generating code for the next scops: the IR has to be cleaned up - and could be in an inconsistent state. */ if (!graphite_regenerate_ast_isl (scop)) - break; - - location_t loc = find_loop_location - (scop->scop_info->region.entry->dest->loop_father); - dump_printf_loc (MSG_OPTIMIZED_LOCATIONS, loc, - "loop nest optimized\n"); + dump_printf_loc (MSG_MISSED_OPTIMIZATION, loc, + "loop nest not optimized, code generation error\n"); + else + dump_printf_loc (MSG_OPTIMIZED_LOCATIONS, loc, + "loop nest optimized\n"); } free_scops (scops);