]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR rtl-optimization/90257 (8% degradation on cpu2006 403.gcc starting with r270484)
authorJakub Jelinek <jakub@redhat.com>
Mon, 29 Apr 2019 14:18:55 +0000 (16:18 +0200)
committerJakub Jelinek <jakub@gcc.gnu.org>
Mon, 29 Apr 2019 14:18:55 +0000 (16:18 +0200)
PR rtl-optimization/90257
* cfgrtl.c (flow_active_insn_p): Return true for USE of a function
return value.

Revert the revert:
2019-04-21  H.J. Lu  <hongjiu.lu@intel.com>

PR target/90178
Revert:
2018-11-21  Uros Bizjak  <ubizjak@gmail.com>

Revert the revert:
2013-10-26  Vladimir Makarov  <vmakarov@redhat.com>

Revert:
2013-10-25  Vladimir Makarov  <vmakarov@redhat.com>

* lra-spills.c (lra_final_code_change): Remove useless move insns.

From-SVN: r270653

gcc/ChangeLog
gcc/cfgrtl.c
gcc/lra-spills.c

index b1c68bbf81f10560d274dfa49e9db9ee78317908..0c2b51a46812ee8c87e2c7bd9105f7e0db8273ff 100644 (file)
@@ -1,3 +1,24 @@
+2019-04-29  Jakub Jelinek  <jakub@redhat.com>
+
+       PR rtl-optimization/90257
+       * cfgrtl.c (flow_active_insn_p): Return true for USE of a function
+       return value.
+
+       Revert the revert:
+       2019-04-21  H.J. Lu  <hongjiu.lu@intel.com>
+
+       PR target/90178
+       Revert:
+       2018-11-21  Uros Bizjak  <ubizjak@gmail.com>
+
+       Revert the revert:
+       2013-10-26  Vladimir Makarov  <vmakarov@redhat.com>
+
+       Revert:
+       2013-10-25  Vladimir Makarov  <vmakarov@redhat.com>
+
+       * lra-spills.c (lra_final_code_change): Remove useless move insns.
+
 2019-04-29  Richard Biener  <rguenther@suse.de>
 
        * tree-ssa.c (insert_debug_temp_for_var_def): For {CLOBBER}
index 08e534f2485cd2bfde214617357a06ceb2a8cb31..e06fb8d5a408c1bbb5bca49c044d5803e80c4c12 100644 (file)
@@ -543,7 +543,7 @@ update_bb_for_insn (basic_block bb)
 }
 
 \f
-/* Like active_insn_p, except keep the return value clobber around
+/* Like active_insn_p, except keep the return value use or clobber around
    even after reload.  */
 
 static bool
@@ -556,8 +556,12 @@ flow_active_insn_p (const rtx_insn *insn)
      programs that fail to return a value.  Its effect is to
      keep the return value from being live across the entire
      function.  If we allow it to be skipped, we introduce the
-     possibility for register lifetime confusion.  */
-  if (GET_CODE (PATTERN (insn)) == CLOBBER
+     possibility for register lifetime confusion.
+     Similarly, keep a USE of the function return value, otherwise
+     the USE is dropped and we could fail to thread jump if USE
+     appears on some paths and not on others, see PR90257.  */
+  if ((GET_CODE (PATTERN (insn)) == CLOBBER
+       || GET_CODE (PATTERN (insn)) == USE)
       && REG_P (XEXP (PATTERN (insn), 0))
       && REG_FUNCTION_VALUE_P (XEXP (PATTERN (insn), 0)))
     return true;
index 18db79e70a08ca36c77de6c8d1ba1bfd0572a1b5..c19b76a579cf7285096031db1801059c6d578c7a 100644 (file)
@@ -740,6 +740,7 @@ lra_final_code_change (void)
   int i, hard_regno;
   basic_block bb;
   rtx_insn *insn, *curr;
+  rtx set;
   int max_regno = max_reg_num ();
 
   for (i = FIRST_PSEUDO_REGISTER; i < max_regno; i++)
@@ -818,5 +819,19 @@ lra_final_code_change (void)
              }
          if (insn_change_p)
            lra_update_operator_dups (id);
+
+         if ((set = single_set (insn)) != NULL
+             && REG_P (SET_SRC (set)) && REG_P (SET_DEST (set))
+             && REGNO (SET_SRC (set)) == REGNO (SET_DEST (set)))
+           {
+             /* Remove an useless move insn.  IRA can generate move
+                insns involving pseudos.  It is better remove them
+                earlier to speed up compiler a bit.  It is also
+                better to do it here as they might not pass final RTL
+                check in LRA, (e.g. insn moving a control register
+                into itself).  */
+             lra_invalidate_insn_data (insn);
+             delete_insn (insn);
+           }
        }
 }