From d7a700e0a701e5164b8c547f76a2d91f657eee97 Mon Sep 17 00:00:00 2001 From: Richard Biener Date: Fri, 1 Mar 2019 09:21:30 +0000 Subject: [PATCH] re PR middle-end/89497 (ICE caused by Segmentation Fault when compiling cups 2.2.10 with LTO flags enabled) 2019-03-01 Richard Biener PR middle-end/89497 * tree-cfgcleanup.h (cleanup_tree_cfg): Add SSA update flags argument, defaulted to zero. * passes.c (execute_function_todo): Pass down SSA update flags to cleanup_tree_cfg. * tree-cfgcleanup.c: Include tree-into-ssa.h and tree-cfgcleanup.h. (cleanup_tree_cfg_noloop): After cleanup_control_flow_pre update SSA form if requested. (cleanup_tree_cfg): Get and pass down SSA update flags. * gcc.dg/tree-ssa/reassoc-43.c: Avoid false match in regex. * g++.dg/tree-prof/devirt.C: Scan tracer dump for foldings that happen now earlier. From-SVN: r269302 --- gcc/ChangeLog | 12 ++++++++++++ gcc/passes.c | 2 +- gcc/testsuite/ChangeLog | 7 +++++++ gcc/testsuite/g++.dg/tree-prof/devirt.C | 6 +++--- gcc/testsuite/gcc.dg/tree-ssa/reassoc-43.c | 2 +- gcc/tree-cfgcleanup.c | 11 ++++++++--- gcc/tree-cfgcleanup.h | 2 +- 7 files changed, 33 insertions(+), 9 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 8759ee895b8..bce3f74b5f3 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,15 @@ +2019-03-01 Richard Biener + + PR middle-end/89497 + * tree-cfgcleanup.h (cleanup_tree_cfg): Add SSA update flags + argument, defaulted to zero. + * passes.c (execute_function_todo): Pass down SSA update flags + to cleanup_tree_cfg. + * tree-cfgcleanup.c: Include tree-into-ssa.h and tree-cfgcleanup.h. + (cleanup_tree_cfg_noloop): After cleanup_control_flow_pre update SSA + form if requested. + (cleanup_tree_cfg): Get and pass down SSA update flags. + 2019-03-01 Jakub Jelinek PR bootstrap/89539 diff --git a/gcc/passes.c b/gcc/passes.c index 7602abd572d..41aa7655ec5 100644 --- a/gcc/passes.c +++ b/gcc/passes.c @@ -1927,7 +1927,7 @@ execute_function_todo (function *fn, void *data) /* Always cleanup the CFG before trying to update SSA. */ if (flags & TODO_cleanup_cfg) { - cleanup_tree_cfg (); + cleanup_tree_cfg (flags & TODO_update_ssa_any); /* When cleanup_tree_cfg merges consecutive blocks, it may perform some simplistic propagation when removing single diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index cf4f06eb88d..b1b4886c3ef 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,10 @@ +2019-03-01 Richard Biener + + PR middle-end/89497 + * gcc.dg/tree-ssa/reassoc-43.c: Avoid false match in regex. + * g++.dg/tree-prof/devirt.C: Scan tracer dump for foldings + that happen now earlier. + 2019-02-28 Eric Botcazou * gcc.c-torture/execute/20190228-1.c: New test. diff --git a/gcc/testsuite/g++.dg/tree-prof/devirt.C b/gcc/testsuite/g++.dg/tree-prof/devirt.C index 3de5dbcf688..8c2913a3930 100644 --- a/gcc/testsuite/g++.dg/tree-prof/devirt.C +++ b/gcc/testsuite/g++.dg/tree-prof/devirt.C @@ -1,5 +1,5 @@ /* PR ipa/88561 */ -/* { dg-options "-O3 -fdump-tree-dom3-details" } */ +/* { dg-options "-O3 -fdump-tree-tracer-details -fdump-tree-dom3-details" } */ struct nsISupports { @@ -121,6 +121,6 @@ main () __builtin_abort (); } -/* { dg-final-use-not-autofdo { scan-tree-dump-times "folding virtual function call to virtual unsigned int mozPersonalDictionary::_ZThn16" 1 "dom3" { target { lp64 || llp64 } } } } */ +/* { dg-final-use-not-autofdo { scan-tree-dump-times "folding virtual function call to virtual unsigned int mozPersonalDictionary::_ZThn16" 1 "tracer" { target { lp64 || llp64 } } } } */ /* { dg-final-use-not-autofdo { scan-tree-dump-times "folding virtual function call to virtual unsigned int mozPersonalDictionary::_ZThn8" 1 "dom3" { target ilp32 } } } */ -/* { dg-final-use-not-autofdo { scan-tree-dump-times "folding virtual function call to virtual unsigned int mozPersonalDictionary::AddRef" 1 "dom3" } } */ +/* { dg-final-use-not-autofdo { scan-tree-dump-times "folding virtual function call to virtual unsigned int mozPersonalDictionary::AddRef" 1 "tracer" } } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/reassoc-43.c b/gcc/testsuite/gcc.dg/tree-ssa/reassoc-43.c index ea44f300f94..90e1e86b3cb 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/reassoc-43.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/reassoc-43.c @@ -50,4 +50,4 @@ c_parser_translation_unit (c_parser * parser) } } } -/* { dg-final { scan-tree-dump-not "0 != 0" "reassoc2"} } */ +/* { dg-final { scan-tree-dump-not "\[ (\]0 != 0" "reassoc2"} } */ diff --git a/gcc/tree-cfgcleanup.c b/gcc/tree-cfgcleanup.c index 63db3308344..f7bd5651a90 100644 --- a/gcc/tree-cfgcleanup.c +++ b/gcc/tree-cfgcleanup.c @@ -44,6 +44,9 @@ along with GCC; see the file COPYING3. If not see #include "gimple-fold.h" #include "tree-ssa-loop-niter.h" #include "cgraph.h" +#include "tree-into-ssa.h" +#include "tree-cfgcleanup.h" + /* The set of blocks in that at least one of the following changes happened: -- the statement at the end of the block was changed @@ -943,7 +946,7 @@ mfb_keep_latches (edge e) Return true if the flowgraph was modified, false otherwise. */ static bool -cleanup_tree_cfg_noloop (void) +cleanup_tree_cfg_noloop (unsigned ssa_update_flags) { timevar_push (TV_TREE_CLEANUP_CFG); @@ -1023,6 +1026,8 @@ cleanup_tree_cfg_noloop (void) /* After doing the above SSA form should be valid (or an update SSA should be required). */ + if (ssa_update_flags) + update_ssa (ssa_update_flags); /* Compute dominator info which we need for the iterative process below. */ if (!dom_info_available_p (CDI_DOMINATORS)) @@ -1125,9 +1130,9 @@ repair_loop_structures (void) /* Cleanup cfg and repair loop structures. */ bool -cleanup_tree_cfg (void) +cleanup_tree_cfg (unsigned ssa_update_flags) { - bool changed = cleanup_tree_cfg_noloop (); + bool changed = cleanup_tree_cfg_noloop (ssa_update_flags); if (current_loops != NULL && loops_state_satisfies_p (LOOPS_NEED_FIXUP)) diff --git a/gcc/tree-cfgcleanup.h b/gcc/tree-cfgcleanup.h index bd27505fd5c..d69b6f5a62d 100644 --- a/gcc/tree-cfgcleanup.h +++ b/gcc/tree-cfgcleanup.h @@ -22,7 +22,7 @@ along with GCC; see the file COPYING3. If not see /* In tree-cfgcleanup.c */ extern bitmap cfgcleanup_altered_bbs; -extern bool cleanup_tree_cfg (void); +extern bool cleanup_tree_cfg (unsigned = 0); extern bool fixup_noreturn_call (gimple *stmt); extern bool delete_unreachable_blocks_update_callgraph (cgraph_node *dst_node, bool update_clones); -- 2.30.2