OSDN Git Service

* config/arm/netbsd.h (TARGET_OS_CPP_BUILTINS): Use
[pf3gnuchains/gcc-fork.git] / gcc / ifcvt.c
index 4b929ab..4ed1494 100644 (file)
@@ -2035,12 +2035,12 @@ find_if_block (test_bb, then_edge, else_edge)
       if (else_bb)
        fprintf (rtl_dump_file,
                 "\nIF-THEN-ELSE block found, start %d, then %d, else %d, join %d\n",
-                test_bb->sindex, then_bb->sindex, else_bb->sindex,
-                join_bb->sindex);
+                test_bb->index, then_bb->index, else_bb->index,
+                join_bb->index);
       else
        fprintf (rtl_dump_file,
                 "\nIF-THEN block found, start %d, then %d, join %d\n",
-                test_bb->sindex, then_bb->sindex, join_bb->sindex);
+                test_bb->index, then_bb->index, join_bb->index);
     }
 
   /* Make sure IF, THEN, and ELSE, blocks are adjacent.  Actually, we
@@ -2092,7 +2092,7 @@ find_cond_trap (test_bb, then_edge, else_edge)
   if (rtl_dump_file)
     {
       fprintf (rtl_dump_file, "\nTRAP-IF block found, start %d, trap %d\n",
-              test_bb->sindex, trap_bb->sindex);
+              test_bb->index, trap_bb->index);
     }
 
   /* If this is not a standard conditional jump, we can't parse it.  */
@@ -2271,6 +2271,7 @@ find_if_case_1 (test_bb, then_edge, else_edge)
   basic_block then_bb = then_edge->dest;
   basic_block else_bb = else_edge->dest, new_bb;
   edge then_succ = then_bb->succ;
+  int then_bb_index;
 
   /* THEN has one successor.  */
   if (!then_succ || then_succ->succ_next != NULL)
@@ -2292,7 +2293,7 @@ find_if_case_1 (test_bb, then_edge, else_edge)
   if (rtl_dump_file)
     fprintf (rtl_dump_file,
             "\nIF-CASE-1 found, start %d, then %d\n",
-            test_bb->sindex, then_bb->sindex);
+            test_bb->index, then_bb->index);
 
   /* THEN is small.  */
   if (count_bb_insns (then_bb) > BRANCH_COST)
@@ -2311,9 +2312,15 @@ find_if_case_1 (test_bb, then_edge, else_edge)
                    then_bb->global_live_at_end, BITMAP_IOR);
   
   new_bb = redirect_edge_and_branch_force (FALLTHRU_EDGE (test_bb), else_bb);
-  /* Make rest of code believe that the newly created block is the THEN_BB
-     block we are going to remove.  */
+  then_bb_index = then_bb->index;
   flow_delete_block (then_bb);
+  /* Make rest of code believe that the newly created block is the THEN_BB
+     block we removed.  */
+  if (new_bb)
+    {
+      new_bb->index = then_bb_index;
+      BASIC_BLOCK (then_bb_index) = new_bb;
+    }
   /* We've possibly created jump to next insn, cleanup_cfg will solve that
      later.  */
 
@@ -2348,16 +2355,16 @@ find_if_case_2 (test_bb, then_edge, else_edge)
     return FALSE;
 
   /* THEN is not EXIT.  */
-  if (then_bb == EXIT_BLOCK_PTR)
+  if (then_bb->index < 0)
     return FALSE;
 
   /* ELSE is predicted or SUCC(ELSE) postdominates THEN.  */
   note = find_reg_note (test_bb->end, REG_BR_PROB, NULL_RTX);
   if (note && INTVAL (XEXP (note, 0)) >= REG_BR_PROB_BASE / 2)
     ;
-  else if (else_succ->dest == EXIT_BLOCK_PTR
-          || TEST_BIT (post_dominators[then_bb->sindex], 
-                       else_succ->dest->sindex))
+  else if (else_succ->dest->index < 0
+          || TEST_BIT (post_dominators[then_bb->index], 
+                       else_succ->dest->index))
     ;
   else
     return FALSE;
@@ -2366,7 +2373,7 @@ find_if_case_2 (test_bb, then_edge, else_edge)
   if (rtl_dump_file)
     fprintf (rtl_dump_file,
             "\nIF-CASE-2 found, start %d, else %d\n",
-            test_bb->sindex, else_bb->sindex);
+            test_bb->index, else_bb->index);
 
   /* ELSE is small.  */
   if (count_bb_insns (then_bb) > BRANCH_COST)
@@ -2697,10 +2704,9 @@ if_convert (x_life_data_ok)
     clear_bb_flags ();
 
   /* Go through each of the basic blocks looking for things to convert.  */
-  FOR_ALL_BB (bb)
+  FOR_EACH_BB (bb)
     while (find_if_header (bb))
-      {
-      }
+      continue;
 
   if (post_dominators)
     sbitmap_vector_free (post_dominators);