This patch removes the old implementation of the warning on RTL. Note: regstat_get_setjmp_crosses() and the associated data seems to be needed for the RA itself, so I am not touching that.
>From c86a8fdc3f91d3cd33d73c7063bb9be2a7ae7e1f Mon Sep 17 00:00:00 2001 From: Vladislav Ivanishin <v...@ispras.ru> Date: Thu, 29 Aug 2019 15:14:59 +0300 Subject: [PATCH 2/3] Remove the old implementation of -Wclobbered gcc/ * function.c (regno_clobbered_at_setjmp): Remove function. (setjmp_vars_warning): Remove function. (setjmp_args_warning): Remove function. (generate_setjmp_warnings): Remove function. * gcc/ira.c (ira): Remove the call to generate_setjmp_warnings. --- gcc/function.c | 76 -------------------------------------------------- gcc/ira.c | 6 ---- 2 files changed, 82 deletions(-) diff --git a/gcc/function.c b/gcc/function.c index 2a0061cad35..8a8e548c303 100644 --- a/gcc/function.c +++ b/gcc/function.c @@ -4181,82 +4181,6 @@ pad_below (struct args_size *offset_ptr, machine_mode passed_mode, tree sizetree } -/* True if register REGNO was alive at a place where `setjmp' was - called and was set more than once or is an argument. Such regs may - be clobbered by `longjmp'. */ - -static bool -regno_clobbered_at_setjmp (bitmap setjmp_crosses, int regno) -{ - /* There appear to be cases where some local vars never reach the - backend but have bogus regnos. */ - if (regno >= max_reg_num ()) - return false; - - return ((REG_N_SETS (regno) > 1 - || REGNO_REG_SET_P (df_get_live_out (ENTRY_BLOCK_PTR_FOR_FN (cfun)), - regno)) - && REGNO_REG_SET_P (setjmp_crosses, regno)); -} - -/* Walk the tree of blocks describing the binding levels within a - function and warn about variables the might be killed by setjmp or - vfork. This is done after calling flow_analysis before register - allocation since that will clobber the pseudo-regs to hard - regs. */ - -static void -setjmp_vars_warning (bitmap setjmp_crosses, tree block) -{ - tree decl, sub; - - for (decl = BLOCK_VARS (block); decl; decl = DECL_CHAIN (decl)) - { - if (VAR_P (decl) - && DECL_RTL_SET_P (decl) - && REG_P (DECL_RTL (decl)) - && regno_clobbered_at_setjmp (setjmp_crosses, REGNO (DECL_RTL (decl)))) - warning (OPT_Wclobbered, "variable %q+D might be clobbered by" - " %<longjmp%> or %<vfork%>", decl); - } - - for (sub = BLOCK_SUBBLOCKS (block); sub; sub = BLOCK_CHAIN (sub)) - setjmp_vars_warning (setjmp_crosses, sub); -} - -/* Do the appropriate part of setjmp_vars_warning - but for arguments instead of local variables. */ - -static void -setjmp_args_warning (bitmap setjmp_crosses) -{ - tree decl; - for (decl = DECL_ARGUMENTS (current_function_decl); - decl; decl = DECL_CHAIN (decl)) - if (DECL_RTL (decl) != 0 - && REG_P (DECL_RTL (decl)) - && regno_clobbered_at_setjmp (setjmp_crosses, REGNO (DECL_RTL (decl)))) - warning (OPT_Wclobbered, - "argument %q+D might be clobbered by %<longjmp%> or %<vfork%>", - decl); -} - -/* Generate warning messages for variables live across setjmp. */ - -void -generate_setjmp_warnings (void) -{ - bitmap setjmp_crosses = regstat_get_setjmp_crosses (); - - if (n_basic_blocks_for_fn (cfun) == NUM_FIXED_BLOCKS - || bitmap_empty_p (setjmp_crosses)) - return; - - setjmp_vars_warning (setjmp_crosses, DECL_INITIAL (current_function_decl)); - setjmp_args_warning (setjmp_crosses); -} - - /* Reverse the order of elements in the fragment chain T of blocks, and return the new head of the chain (old last element). In addition to that clear BLOCK_SAME_RANGE flags when needed diff --git a/gcc/ira.c b/gcc/ira.c index c58daba6e79..e21778c2c9e 100644 --- a/gcc/ira.c +++ b/gcc/ira.c @@ -5293,12 +5293,6 @@ ira (FILE *f) regstat_init_n_sets_and_refs (); regstat_compute_ri (); - /* If we are not optimizing, then this is the only place before - register allocation where dataflow is done. And that is needed - to generate these warnings. */ - if (warn_clobbered) - generate_setjmp_warnings (); - if (resize_reg_info () && flag_ira_loop_pressure) ira_set_pseudo_classes (true, ira_dump_file); -- 2.22.0