frv.c (frv_ifcvt_modify_insn): Don't leave alone scratch insns of the then branch...
authorAlexandre Oliva <aoliva@redhat.com>
Thu, 18 Dec 2003 04:24:06 +0000 (04:24 +0000)
committerAlexandre Oliva <aoliva@gcc.gnu.org>
Thu, 18 Dec 2003 04:24:06 +0000 (04:24 +0000)
* config/frv/frv.c (frv_ifcvt_modify_insn): Don't leave alone
scratch insns of the then branch that clobber regs needed by the
else branch.

From-SVN: r74771

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

index ce2fa51b499b5b19c3317b16b8d561bc70c7ca9c..ba3bd9d4a7c21ffc21fd2ee7423bfb60da379ead 100644 (file)
@@ -1,3 +1,9 @@
+2003-12-17  Alexandre Oliva  <aoliva@redhat.com>
+
+       * config/frv/frv.c (frv_ifcvt_modify_insn): Don't leave alone
+       scratch insns of the then branch that clobber regs needed by the
+       else branch.
+
 2003-12-17  Kazu Hirata  <kazu@cs.umass.edu>
 
        * calls.c (expand_call): Update comments.
index 8d36bc61c45981495bf64fe772eefb22a4d711fc..6ee418474843717e159b2953b392868483b10050 100644 (file)
@@ -6942,7 +6942,7 @@ single_set_pattern (rtx pattern)
    insn cannot be converted to be executed conditionally.  */
 
 rtx
-frv_ifcvt_modify_insn (ce_if_block_t *ce_info ATTRIBUTE_UNUSED,
+frv_ifcvt_modify_insn (ce_if_block_t *ce_info,
                        rtx pattern,
                        rtx insn)
 {
@@ -7068,7 +7068,16 @@ frv_ifcvt_modify_insn (ce_if_block_t *ce_info ATTRIBUTE_UNUSED,
          other registers.  */
       else if (frv_ifcvt.scratch_insns_bitmap
               && bitmap_bit_p (frv_ifcvt.scratch_insns_bitmap,
-                               INSN_UID (insn)))
+                               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))
+              && (! ce_info->else_bb
+                  || BLOCK_FOR_INSN (insn) == ce_info->else_bb
+                  || ! (REGNO_REG_SET_P
+                        (ce_info->else_bb->global_live_at_start,
+                         REGNO (SET_DEST (set))))))
        pattern = set;
 
       else if (mode == QImode || mode == HImode || mode == SImode