From 1b6fa86002afb4a8f28ab40afc812ec5e73ccba6 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Thu, 17 Mar 2011 13:35:04 +0100 Subject: [PATCH] re PR rtl-optimization/48141 (DSE compile time hog) PR rtl-optimization/48141 * dse.c (record_store): If no positions are needed in an insn that cannot be deleted, at least unchain it from active_local_stores. * gcc.dg/pr48141.c: New test. From-SVN: r171089 --- gcc/ChangeLog | 6 ++++++ gcc/dse.c | 8 ++++---- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gcc.dg/pr48141.c | 17 +++++++++++++++++ 4 files changed, 32 insertions(+), 4 deletions(-) create mode 100644 gcc/testsuite/gcc.dg/pr48141.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 8ab1bd0a3f6..a0bdc239f2d 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2011-03-17 Jakub Jelinek + + PR rtl-optimization/48141 + * dse.c (record_store): If no positions are needed in an insn + that cannot be deleted, at least unchain it from active_local_stores. + 2011-03-16 Dodji Seketeli PR debug/47510 diff --git a/gcc/dse.c b/gcc/dse.c index 8e9b6454e39..e43ab72d742 100644 --- a/gcc/dse.c +++ b/gcc/dse.c @@ -1,5 +1,5 @@ /* RTL dead store elimination. - Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 + Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc. Contributed by Richard Sandiford @@ -1530,8 +1530,7 @@ record_store (rtx body, bb_info_t bb_info) /* An insn can be deleted if every position of every one of its s_infos is zero. */ - if (any_positions_needed_p (s_info) - || ptr->cannot_delete) + if (any_positions_needed_p (s_info)) del = false; if (del) @@ -1543,7 +1542,8 @@ record_store (rtx body, bb_info_t bb_info) else active_local_stores = ptr->next_local_store; - delete_dead_store_insn (insn_to_delete); + if (!insn_to_delete->cannot_delete) + delete_dead_store_insn (insn_to_delete); } else last = ptr; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index b05752483d6..b76cd474955 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2011-03-17 Jakub Jelinek + + PR rtl-optimization/48141 + * gcc.dg/pr48141.c: New test. + 2011-03-16 Jason Merrill * g++.dg/cpp0x/constexpr-48089.C: New. diff --git a/gcc/testsuite/gcc.dg/pr48141.c b/gcc/testsuite/gcc.dg/pr48141.c new file mode 100644 index 00000000000..006f5cb1440 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr48141.c @@ -0,0 +1,17 @@ +/* PR rtl-optimization/48141 */ +/* { dg-do compile } */ +/* { dg-options "-O" } */ + +#define A i = 0; +#define B A A A A A A A A A A +#define C B B B B B B B B B B +#define D C C C C C C C C C C +#define E D D D D D D D D D D + +int +foo (void) +{ + volatile int i = 0; + E E E E E E E E E E E + return 0; +} -- 2.30.2