OSDN Git Service

* ifcvt.c (dead_or_predicable): Don't move code if eh regions
[pf3gnuchains/gcc-fork.git] / gcc / ifcvt.c
index 6ad1d35..a5494b8 100644 (file)
@@ -487,7 +487,7 @@ noce_emit_store_flag (if_info, x, reversep, normalize)
      build the store_flag insn directly.  */
 
   if (cond_complex)
-    cond = XEXP (SET_SRC (PATTERN (if_info->jump)), 0);
+    cond = XEXP (SET_SRC (pc_set (if_info->jump)), 0);
 
   if ((if_info->cond_earliest == if_info->jump || cond_complex)
       && (normalize == 0 || STORE_FLAG_VALUE == normalize))
@@ -1855,6 +1855,15 @@ dead_or_predicable (test_bb, merge_bb, other_bb, new_dest, reversep)
 {
   rtx head, end, jump, earliest, old_dest;
 
+  /* No code movement can occur if we'd be scrogging EH regions.
+     Within MERGE_BB, ensure that we've not got stray EH_BEG or EH_END
+     notes within the block.  Between the blocks, checking that the end
+     region numbers match ensures that we won't disrupt the nesting
+     between regions.  */
+  if (merge_bb->eh_beg != merge_bb->eh_end
+      || merge_bb->eh_end != test_bb->eh_end)
+    return FALSE;
+
   jump = test_bb->end;
 
   /* Find the extent of the real code in the merge block.  */
@@ -1973,7 +1982,7 @@ dead_or_predicable (test_bb, merge_bb, other_bb, new_dest, reversep)
       /* ??? bb->local_set is only valid during calculate_global_regs_live,
         so we must recompute usage for MERGE_BB.  Not so bad, I suppose, 
          since we've already asserted that MERGE_BB is small.  */
-      propagate_block (merge_bb, tmp, merge_set, 0);
+      propagate_block (merge_bb, tmp, merge_set, merge_set, 0);
 
       /* For small register class machines, don't lengthen lifetimes of
         hard registers before reload.  */
@@ -1993,7 +2002,8 @@ dead_or_predicable (test_bb, merge_bb, other_bb, new_dest, reversep)
         Moreover, we're interested in the insns live from OTHER_BB.  */
 
       COPY_REG_SET (test_live, other_bb->global_live_at_start);
-      pbi = init_propagate_block_info (test_bb, test_live, test_set, 0);
+      pbi = init_propagate_block_info (test_bb, test_live, test_set, test_set,
+                                      0);
 
       for (insn = jump; ; insn = prev)
        {