re PR rtl-optimization/55154 (ICE: in curr_insn_transform, at lra-constraints.c:2702...
authorVladimir Makarov <vmakarov@redhat.com>
Fri, 9 Nov 2012 15:33:19 +0000 (15:33 +0000)
committerVladimir Makarov <vmakarov@gcc.gnu.org>
Fri, 9 Nov 2012 15:33:19 +0000 (15:33 +0000)
2012-11-09  Vladimir Makarov  <vmakarov@redhat.com>

PR tree-optimization/55154
* lra-int.h (LRA_LOSER_COST_FACTOR, LRA_MAX_REJECT): New macros.
* lra.c (setup_operand_alternative): Use them.
* lra-constraints.c (LOSER_COST_FACTOR, MAX_OVERALL_COST_BOUND):
Remove.
(process_alt_operands): Use LRA_LOSER_COST_FACTOR and
LRA_MAX_REJECT.  Accumulate reject instead of setting for
non-const.
(curr_insn_transform): Initialize best_losers and best_overall by
INT_MAX.

2012-11-09  Vladimir Makarov  <vmakarov@redhat.com>

PR rtl-optimization/55154
* gcc.target/i386/pr55154.c: New test.

From-SVN: r193364

gcc/ChangeLog
gcc/lra-constraints.c
gcc/lra-int.h
gcc/lra.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.target/i386/pr55154.c [new file with mode: 0644]

index 651c083..cd98089 100644 (file)
@@ -1,3 +1,16 @@
+2012-11-09  Vladimir Makarov  <vmakarov@redhat.com>
+
+       PR tree-optimization/55154
+       * lra-int.h (LRA_LOSER_COST_FACTOR, LRA_MAX_REJECT): New macros.
+       * lra.c (setup_operand_alternative): Use them.
+       * lra-constraints.c (LOSER_COST_FACTOR, MAX_OVERALL_COST_BOUND):
+       Remove.
+       (process_alt_operands): Use LRA_LOSER_COST_FACTOR and
+       LRA_MAX_REJECT.  Accumulate reject instead of setting for
+       non-const.
+       (curr_insn_transform): Initialize best_losers and best_overall by
+       INT_MAX.
+
 2012-11-09  Christian Bruel  <christian.bruel@st.com>
 
        * config/sh/sh.c (sh_can_use_simple_return_p): Enable with
@@ -44,7 +57,6 @@
        * config/i386/i386.c (release_scratch_register_on_entry): Also adjust
        sp_offset manually.
 
->>>>>>> .r193360
 2012-11-08  Christian Bruel  <christian.bruel@st.com>
 
        * tree-ssa-tail-merge.c (replace_block_by): Update bb2 profile count.
index bcba590..b4e3218 100644 (file)
@@ -1282,12 +1282,6 @@ general_constant_p (rtx x)
   return CONSTANT_P (x) && (! flag_pic || LEGITIMATE_PIC_OPERAND_P (x));
 }
 
-/* Cost factor for each additional reload and maximal cost bound for
-   insn reloads.  One might ask about such strange numbers.  Their
-   values occurred historically from former reload pass.  */
-#define LOSER_COST_FACTOR 6
-#define MAX_OVERALL_COST_BOUND 600
-
 /* Major function to choose the current insn alternative and what
    operands should be reloaded and how.         If ONLY_ALTERNATIVE is not
    negative we should consider only this alternative.  Return false if
@@ -1576,6 +1570,7 @@ process_alt_operands (int only_alternative)
                    badop = false;
                    this_alternative = curr_alt[m];
                    COPY_HARD_REG_SET (this_alternative_set, curr_alt_set[m]);
+                   winreg = this_alternative != NO_REGS;
                    break;
                  }
 
@@ -1828,7 +1823,7 @@ process_alt_operands (int only_alternative)
                     might cost something but probably less than old
                     reload pass believes.  */
                  if (lra_former_scratch_p (REGNO (operand_reg[nop])))
-                   reject += LOSER_COST_FACTOR;
+                   reject += LRA_LOSER_COST_FACTOR;
                }
            }
          else if (did_match)
@@ -1912,20 +1907,15 @@ process_alt_operands (int only_alternative)
                      && no_input_reloads_p && ! const_to_mem))
                goto fail;
 
-             /* If we can't reload this value at all, reject this
-                alternative.  Note that we could also lose due to
-                LIMIT_RELOAD_CLASS, but we don't check that here.  */
-             if (! CONSTANT_P (op) && ! no_regs_p)
-               {
-                 if (targetm.preferred_reload_class
-                     (op, this_alternative) == NO_REGS)
-                   reject = MAX_OVERALL_COST_BOUND;
-
-                 if (curr_static_id->operand[nop].type == OP_OUT
-                     && (targetm.preferred_output_reload_class
-                         (op, this_alternative) == NO_REGS))
-                   reject = MAX_OVERALL_COST_BOUND;
-               }
+             /* Check strong discouragement of reload of non-constant
+                into class THIS_ALTERNATIVE.  */
+             if (! CONSTANT_P (op) && ! no_regs_p
+                 && (targetm.preferred_reload_class
+                     (op, this_alternative) == NO_REGS
+                     || (curr_static_id->operand[nop].type == OP_OUT
+                         && (targetm.preferred_output_reload_class
+                             (op, this_alternative) == NO_REGS))))
+               reject += LRA_MAX_REJECT;
 
              if (! ((const_to_mem && constmemok)
                     || (MEM_P (op) && offmemok)))
@@ -1966,7 +1956,7 @@ process_alt_operands (int only_alternative)
             Should we update the cost (may be approximately) here
             because of early clobber register reloads or it is a rare
             or non-important thing to be worth to do it.  */
-         overall = losers * LOSER_COST_FACTOR + reject;
+         overall = losers * LRA_LOSER_COST_FACTOR + reject;
          if ((best_losers == 0 || losers != 0) && best_overall < overall)
            goto fail;
 
@@ -2019,7 +2009,7 @@ process_alt_operands (int only_alternative)
              {
                curr_alt_match_win[j] = false;
                losers++;
-               overall += LOSER_COST_FACTOR;
+               overall += LRA_LOSER_COST_FACTOR;
              }
          if (! curr_alt_match_win[i])
            curr_alt_dont_inherit_ops[curr_alt_dont_inherit_ops_num++] = i;
@@ -2032,7 +2022,7 @@ process_alt_operands (int only_alternative)
            }
          curr_alt_win[i] = curr_alt_match_win[i] = false;
          losers++;
-         overall += LOSER_COST_FACTOR;
+         overall += LRA_LOSER_COST_FACTOR;
        }
       small_class_operands_num = 0;
       for (nop = 0; nop < n_operands; nop++)
@@ -2635,7 +2625,7 @@ curr_insn_transform (void)
      the wrong kind of hard reg.  For this, we must consider all the
      operands together against the register constraints.  */
 
-  best_losers = best_overall = MAX_RECOG_OPERANDS * 2 + MAX_OVERALL_COST_BOUND;
+  best_losers = best_overall = INT_MAX;
   best_small_class_operands_num = best_reload_sum = 0;
 
   curr_swapped = false;
index abb6d71..04d5528 100644 (file)
@@ -243,6 +243,12 @@ typedef struct lra_insn_recog_data *lra_insn_recog_data_t;
 #define LRA_TEMP_CLOBBER_P(x) \
   (RTL_FLAG_CHECK1 ("TEMP_CLOBBER_P", (x), CLOBBER)->unchanging)
 
+/* Cost factor for each additional reload and maximal cost reject for
+   insn reloads.  One might ask about such strange numbers.  Their
+   values occurred historically from former reload pass.  */
+#define LRA_LOSER_COST_FACTOR 6
+#define LRA_MAX_REJECT 600
+
 /* lra.c: */
 
 extern FILE *lra_dump_file;
index 0705ad7..b75f417 100644 (file)
--- a/gcc/lra.c
+++ b/gcc/lra.c
@@ -784,10 +784,10 @@ setup_operand_alternative (lra_insn_recog_data_t data)
                  break;
 
                case '?':
-                 op_alt->reject += 6;
+                 op_alt->reject += LRA_LOSER_COST_FACTOR;
                  break;
                case '!':
-                 op_alt->reject += 600;
+                 op_alt->reject += LRA_MAX_REJECT;
                  break;
                case '&':
                  op_alt->earlyclobber = 1;
index fbc576b..73ad252 100644 (file)
@@ -1,5 +1,10 @@
 2012-11-09  Vladimir Makarov  <vmakarov@redhat.com>
 
+       PR rtl-optimization/55154
+       * gcc.target/i386/pr55154.c: New test.
+
+2012-11-09  Vladimir Makarov  <vmakarov@redhat.com>
+
        PR rtl-optimization/55151
        * gcc.dg/pr55151.c: Move ...
        * gcc.target/i386/pr55151.c: ... here.
diff --git a/gcc/testsuite/gcc.target/i386/pr55154.c b/gcc/testsuite/gcc.target/i386/pr55154.c
new file mode 100644 (file)
index 0000000..2ed3f00
--- /dev/null
@@ -0,0 +1,11 @@
+/* { dg-do compile } */
+/* { dg-require-effective-target lp64 } */
+/* { dg-require-effective-target fpic } */
+/* { dg-options "-O2 -mcx16 -fpic -mcmodel=large -fno-split-wide-types" } */
+
+__int128 i;
+
+void test ()
+{
+  __sync_val_compare_and_swap (&i, i, i);
+}