aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteven Bosscher <steven@gcc.gnu.org>2012-12-05 23:55:28 +0000
committerSteven Bosscher <steven@gcc.gnu.org>2012-12-05 23:55:28 +0000
commit85f9ce675d6a08e8daf713ea0b8b97edde08fd0b (patch)
treedd461e9466c11bba0bdb0180dcc8f3a32539b025
parentaeb9f7cf3ce55e65fb9f435702e20c7c3f37d7e5 (diff)
downloadgcc-85f9ce675d6a08e8daf713ea0b8b97edde08fd0b.zip
gcc-85f9ce675d6a08e8daf713ea0b8b97edde08fd0b.tar.gz
gcc-85f9ce675d6a08e8daf713ea0b8b97edde08fd0b.tar.bz2
re PR rtl-optimization/55604 (ICE while dumping in remove_some_program_points_and_update_live_ranges)
PR rtl-optimization/55604 * lra-lives.c (lra_create_live_ranges): If there are no referenced pseudos left, do not compute live ranges. From-SVN: r194230
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/lra-lives.c20
2 files changed, 24 insertions, 2 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index efeafd3..b6326f3 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,11 @@
2012-12-05 Steven Bosscher <steven@gcc.gnu.org>
+ PR rtl-optimization/55604
+ * lra-lives.c (lra_create_live_ranges): If there are no referenced
+ pseudos left, do not compute live ranges.
+
+2012-12-05 Steven Bosscher <steven@gcc.gnu.org>
+
* doc/tm.texi.in (TARGET_CLASS_LIKELY_SPILLED_P): Update documentation.
* doc/tm.texi: Regenerate.
* regs.h (REG_LIVE_LENGTH): Update comments to not refer to no longer
diff --git a/gcc/lra-lives.c b/gcc/lra-lives.c
index c79b95b..4764ae6 100644
--- a/gcc/lra-lives.c
+++ b/gcc/lra-lives.c
@@ -915,6 +915,7 @@ lra_create_live_ranges (bool all_p)
basic_block bb;
int i, hard_regno, max_regno = max_reg_num ();
int curr_point;
+ bool have_referenced_pseudos = false;
timevar_push (TV_LRA_CREATE_LIVE_RANGES);
@@ -947,10 +948,24 @@ lra_create_live_ranges (bool all_p)
lra_reg_info[i].call_p = false;
#endif
if (i >= FIRST_PSEUDO_REGISTER
- && lra_reg_info[i].nrefs != 0 && (hard_regno = reg_renumber[i]) >= 0)
- lra_hard_reg_usage[hard_regno] += lra_reg_info[i].freq;
+ && lra_reg_info[i].nrefs != 0)
+ {
+ if ((hard_regno = reg_renumber[i]) >= 0)
+ lra_hard_reg_usage[hard_regno] += lra_reg_info[i].freq;
+ have_referenced_pseudos = true;
+ }
}
lra_free_copies ();
+
+ /* Under some circumstances, we can have functions without pseudo
+ registers. For such functions, lra_live_max_point will be 0,
+ see e.g. PR55604, and there's nothing more to do for us here. */
+ if (! have_referenced_pseudos)
+ {
+ timevar_pop (TV_LRA_CREATE_LIVE_RANGES);
+ return;
+ }
+
pseudos_live = sparseset_alloc (max_regno);
pseudos_live_through_calls = sparseset_alloc (max_regno);
pseudos_live_through_setjumps = sparseset_alloc (max_regno);
@@ -973,6 +988,7 @@ lra_create_live_ranges (bool all_p)
}
free (post_order_rev_cfg);
lra_live_max_point = curr_point;
+ gcc_checking_assert (lra_live_max_point > 0);
if (lra_dump_file != NULL)
print_live_ranges (lra_dump_file);
/* Clean up. */