aboutsummaryrefslogtreecommitdiff
path: root/gcc/lra-constraints.c
diff options
context:
space:
mode:
authorVladimir Makarov <vmakarov@redhat.com>2012-11-16 16:32:02 +0000
committerVladimir Makarov <vmakarov@gcc.gnu.org>2012-11-16 16:32:02 +0000
commite731262b38e57a608b2c12ffc76fb682c1672d31 (patch)
treea2aecfec468c72eb968845c9b6c5a3fc82698f1b /gcc/lra-constraints.c
parentce1a1562859498a73f74bcc3f008e6a1357ba13a (diff)
downloadgcc-e731262b38e57a608b2c12ffc76fb682c1672d31.zip
gcc-e731262b38e57a608b2c12ffc76fb682c1672d31.tar.gz
gcc-e731262b38e57a608b2c12ffc76fb682c1672d31.tar.bz2
re PR rtl-optimization/55330 (ICE: Maximum number of LRA constraint passes is achieved (15) on gfortran.dg/actual_array_constructor_1.f90)
2012-11-16 Vladimir Makarov <vmakarov@redhat.com> PR rtl-optimization/55330 * lra-constraints.c (MAX_INHERITANCE_PASSES): New macro. (lra_inheritance, lra_undo_inheritance): Use it to limit number of the passes. 2012-11-16 Vladimir Makarov <vmakarov@redhat.com> PR rtl-optimization/55330 * gfortran.dg/pr55330.f90: New test. From-SVN: r193567
Diffstat (limited to 'gcc/lra-constraints.c')
-rw-r--r--gcc/lra-constraints.c21
1 files changed, 20 insertions, 1 deletions
diff --git a/gcc/lra-constraints.c b/gcc/lra-constraints.c
index b4e3218..6f19c18 100644
--- a/gcc/lra-constraints.c
+++ b/gcc/lra-constraints.c
@@ -4633,6 +4633,21 @@ inherit_in_ebb (rtx head, rtx tail)
return change_p;
}
+/* The maximal number of inheritance/split passes in LRA. It should
+ be more 1 in order to perform caller saves transformations and much
+ less MAX_CONSTRAINT_ITERATION_NUMBER to prevent LRA to do as many
+ as permitted constraint passes in some complicated cases. The
+ first inheritance/split pass has a biggest impact on generated code
+ quality. Each subsequent affects generated code in less degree.
+ For example, the 3rd pass does not change generated SPEC2000 code
+ at all on x86-64. */
+#define MAX_INHERITANCE_PASSES 2
+
+#if MAX_INHERITANCE_PASSES <= 0 \
+ || MAX_INHERITANCE_PASSES >= MAX_CONSTRAINT_ITERATION_NUMBER - 8
+#error wrong MAX_INHERITANCE_PASSES value
+#endif
+
/* This value affects EBB forming. If probability of edge from EBB to
a BB is not greater than the following value, we don't add the BB
to EBB. */
@@ -4649,8 +4664,10 @@ lra_inheritance (void)
basic_block bb, start_bb;
edge e;
- timevar_push (TV_LRA_INHERITANCE);
lra_inheritance_iter++;
+ if (lra_inheritance_iter > MAX_INHERITANCE_PASSES)
+ return;
+ timevar_push (TV_LRA_INHERITANCE);
if (lra_dump_file != NULL)
fprintf (lra_dump_file, "\n********** Inheritance #%d: **********\n\n",
lra_inheritance_iter);
@@ -4920,6 +4937,8 @@ lra_undo_inheritance (void)
bool change_p;
lra_undo_inheritance_iter++;
+ if (lra_undo_inheritance_iter > MAX_INHERITANCE_PASSES)
+ return false;
if (lra_dump_file != NULL)
fprintf (lra_dump_file,
"\n********** Undoing inheritance #%d: **********\n\n",