frv.c (frv_ifcvt_modify_insn): Don't leave alone scratch insns that set a register...
authorAlexandre Oliva <aoliva@redhat.com>
Fri, 26 Nov 2004 18:53:47 +0000 (18:53 +0000)
committerAlexandre Oliva <aoliva@gcc.gnu.org>
Fri, 26 Nov 2004 18:53:47 +0000 (18:53 +0000)
* config/frv/frv.c (frv_ifcvt_modify_insn): Don't leave alone
scratch insns that set a register live at the join point.

From-SVN: r91344

gcc/ChangeLog
gcc/config/frv/frv.c

index 5f6d899f5465f8afe959ea2d35979a0f5102cc5b..5f9c8281b75b1a6d4ceb29081dfcea79da888955 100644 (file)
@@ -1,3 +1,8 @@
+2004-11-26  Alexandre Oliva  <aoliva@redhat.com>
+
+       * config/frv/frv.c (frv_ifcvt_modify_insn): Don't leave alone
+       scratch insns that set a register live at the join point.
+
 2004-11-26  Kazu Hirata  <kazu@cs.umass.edu>
 
        * cse.c, tree-ssa-operands.c: Fix comment typos.
index 19faaa67592fbe33b21887901757f445d7e3dcf1..de976898d97a6a33bb354f53e4cf2a29433777ee 100644 (file)
@@ -7418,10 +7418,28 @@ frv_ifcvt_modify_insn (ce_if_block_t *ce_info,
       else if (frv_ifcvt.scratch_insns_bitmap
               && bitmap_bit_p (frv_ifcvt.scratch_insns_bitmap,
                                INSN_UID (insn))
-              /* We must not unconditionally set a reg set used as
-                 scratch in the THEN branch if the same reg is live
-                 in the ELSE branch.  */
               && REG_P (SET_DEST (set))
+              /* We must not unconditionally set a scratch reg chosen
+                 for a nested if-converted block if its incoming
+                 value from the TEST block (or the result of the THEN
+                 branch) could/should propagate to the JOIN block.
+                 It suffices to test whether the register is live at
+                 the JOIN point: if it's live there, we can infer
+                 that we set it in the former JOIN block of the
+                 nested if-converted block (otherwise it wouldn't
+                 have been available as a scratch register), and it
+                 is either propagated through or set in the other
+                 conditional block.  It's probably not worth trying
+                 to catch the latter case, and it could actually
+                 limit scheduling of the combined block quite
+                 severely.  */
+              && ce_info->join_bb
+              && ! (REGNO_REG_SET_P
+                    (ce_info->join_bb->global_live_at_start,
+                     REGNO (SET_DEST (set))))
+              /* Similarly, we must not unconditionally set a reg
+                 used as scratch in the THEN branch if the same reg
+                 is live in the ELSE branch.  */
               && (! ce_info->else_bb
                   || BLOCK_FOR_INSN (insn) == ce_info->else_bb
                   || ! (REGNO_REG_SET_P