From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 52123 invoked by alias); 10 May 2017 14:18:22 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 52086 invoked by uid 89); 10 May 2017 14:18:21 -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=academic 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; Wed, 10 May 2017 14:18:18 +0000 Received: from relay2.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 319B2AAB2 for ; Wed, 10 May 2017 14:18:19 +0000 (UTC) Date: Wed, 10 May 2017 14:20:00 -0000 From: Richard Biener To: gcc-patches@gcc.gnu.org Subject: [PATCH] Verify loops with TODO_verify_il Message-ID: User-Agent: Alpine 2.20 (LSU 67 2015-01-07) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-SW-Source: 2017-05/txt/msg00785.txt.bz2 This fixes two remaining issues with properly preserving loops, one academic with -dx which skips all RTL optimizers and then ICEs in clean_state when trying to verify loops after we freed everything else. One maybe serious where TM instrumentation wrecks loops but doesn't tell others about this (TM might be a reason to not "ignore" loops with abnormal edges?). Re-bootstrap and regtest running on x86_64-unknown-linux-gnu. Richard. 2017-05-10 Richard Biener * passes.c (execute_function_todo): Verify loops if they are said to be up-to-date. * cfgexpand.c (pass_expand::execute): Discard loops for -dx. * trans-mem.c (pass_tm_edges::execute): Mark loops for fixup. Index: gcc/passes.c =================================================================== --- gcc/passes.c (revision 247838) +++ gcc/passes.c (working copy) @@ -1979,8 +1979,12 @@ execute_function_todo (function *fn, voi && !from_ipa_pass) verify_flow_info (); if (current_loops - && loops_state_satisfies_p (LOOP_CLOSED_SSA)) - verify_loop_closed_ssa (false); + && ! loops_state_satisfies_p (LOOPS_NEED_FIXUP)) + { + verify_loop_structure (); + if (loops_state_satisfies_p (LOOP_CLOSED_SSA)) + verify_loop_closed_ssa (false); + } if (cfun->curr_properties & PROP_rtl) verify_rtl_sharing (); } Index: gcc/cfgexpand.c =================================================================== --- gcc/cfgexpand.c (revision 247838) +++ gcc/cfgexpand.c (working copy) @@ -6542,6 +6542,14 @@ pass_expand::execute (function *fun) set_block_levels (DECL_INITIAL (fun->decl), 0); default_rtl_profile (); + /* For -dx discard loops now, otherwise IL verify in clean_state will + ICE. */ + if (rtl_dump_and_exit) + { + cfun->curr_properties &= ~PROP_loops; + loop_optimizer_finalize (); + } + timevar_pop (TV_POST_EXPAND); return 0; Index: gcc/trans-mem.c =================================================================== --- gcc/trans-mem.c (revision 247838) +++ gcc/trans-mem.c (working copy) @@ -3369,6 +3369,8 @@ pass_tm_edges::execute (function *fun) must be rebuilt completely. Otherwise we'll crash trying to update the SSA web in the TODO section following this pass. */ free_dominance_info (CDI_DOMINATORS); + /* We'ge also wrecked loops badly with inserting of abnormal edges. */ + loops_state_set (LOOPS_NEED_FIXUP); bitmap_obstack_release (&tm_obstack); all_tm_regions = NULL;