Silence overactive sanity check with -fpartial-profile-training
[gcc.git] / gcc / combine.c
index 857ea30dafd917445220de42a845ff5c65275e8b..16e606d8a21ff424ff313d16a201055b2d3ce285 100644 (file)
@@ -100,7 +100,6 @@ along with GCC; see the file COPYING3.  If not see
 #include "insn-attr.h"
 #include "rtlhooks-def.h"
 #include "expr.h"
-#include "params.h"
 #include "tree-pass.h"
 #include "valtrack.h"
 #include "rtl-iter.h"
@@ -1234,8 +1233,7 @@ combine_instructions (rtx_insn *f, unsigned int nregs)
                                                    insn);
 
            /* Record the current insn_cost of this instruction.  */
-           if (NONJUMP_INSN_P (insn))
-             INSN_COST (insn) = insn_cost (insn, optimize_this_for_speed_p);
+           INSN_COST (insn) = insn_cost (insn, optimize_this_for_speed_p);
            if (dump_file)
              {
                fprintf (dump_file, "insn_cost %d for ", INSN_COST (insn));
@@ -1251,7 +1249,7 @@ combine_instructions (rtx_insn *f, unsigned int nregs)
   init_reg_last ();
   setup_incoming_promotions (first);
   last_bb = ENTRY_BLOCK_PTR_FOR_FN (cfun);
-  int max_combine = PARAM_VALUE (PARAM_MAX_COMBINE_INSNS);
+  int max_combine = param_max_combine_insns;
 
   FOR_EACH_BB_FN (this_basic_block, cfun)
     {
@@ -2112,7 +2110,7 @@ can_combine_p (rtx_insn *insn, rtx_insn *i3, rtx_insn *pred ATTRIBUTE_UNUSED,
   is_volatile_p = volatile_refs_p (PATTERN (insn))
     ? volatile_refs_p
     : volatile_insn_p;
-    
+
   for (p = NEXT_INSN (insn); p != i3; p = NEXT_INSN (p))
     if (INSN_P (p) && p != succ && p != succ2 && is_volatile_p (PATTERN (p)))
       return 0;
@@ -2120,13 +2118,14 @@ can_combine_p (rtx_insn *insn, rtx_insn *i3, rtx_insn *pred ATTRIBUTE_UNUSED,
   /* If INSN contains an autoincrement or autodecrement, make sure that
      register is not used between there and I3, and not already used in
      I3 either.  Neither must it be used in PRED or SUCC, if they exist.
-     Also insist that I3 not be a jump; if it were one
-     and the incremented register were spilled, we would lose.  */
+     Also insist that I3 not be a jump if using LRA; if it were one
+     and the incremented register were spilled, we would lose.
+     Reload handles this correctly.  */
 
   if (AUTO_INC_DEC)
     for (link = REG_NOTES (insn); link; link = XEXP (link, 1))
       if (REG_NOTE_KIND (link) == REG_INC
-         && (JUMP_P (i3)
+         && ((JUMP_P (i3) && targetm.lra_p ())
              || reg_used_between_p (XEXP (link, 0), insn, i3)
              || (pred != NULL_RTX
                  && reg_overlap_mentioned_p (XEXP (link, 0), PATTERN (pred)))
@@ -11813,7 +11812,9 @@ gen_lowpart_for_combine (machine_mode omode, rtx x)
 
   /* If X is a comparison operator, rewrite it in a new mode.  This
      probably won't match, but may allow further simplifications.  */
-  else if (COMPARISON_P (x))
+  else if (COMPARISON_P (x)
+          && SCALAR_INT_MODE_P (imode)
+          && SCALAR_INT_MODE_P (omode))
     return gen_rtx_fmt_ee (GET_CODE (x), omode, XEXP (x, 0), XEXP (x, 1));
 
   /* If we couldn't simplify X any other way, just enclose it in a
@@ -13282,7 +13283,7 @@ record_value_for_reg (rtx reg, rtx_insn *insn, rtx value)
            {
              /* If there are two or more occurrences of REG in VALUE,
                 prevent the value from growing too much.  */
-             if (count_rtxs (tem) > MAX_LAST_VALUE_RTL)
+             if (count_rtxs (tem) > param_max_last_value_rtl)
                tem = gen_rtx_CLOBBER (GET_MODE (tem), const0_rtx);
            }