]> git.ipfire.org Git - thirdparty/gcc.git/blobdiff - gcc/tree-ssa-ccp.c
Merger of git branch "gimple-classes-v2-option-3"
[thirdparty/gcc.git] / gcc / tree-ssa-ccp.c
index 2c8f6b9effd779f288a951ad291c499d35e8bfb0..fced23af2bfe3a5048eea9f2a93f35260cb7ea6a 100644 (file)
@@ -839,11 +839,11 @@ ccp_initialize (void)
      except for phi nodes for virtual operands when we do not do store ccp.  */
   FOR_EACH_BB_FN (bb, cfun)
     {
-      gimple_stmt_iterator i;
+      gphi_iterator i;
 
       for (i = gsi_start_phis (bb); !gsi_end_p (i); gsi_next (&i))
         {
-          gimple phi = gsi_stmt (i);
+          gphi *phi = i.phi ();
 
          if (virtual_operand_p (gimple_phi_result (phi)))
             prop_set_simulate_again (phi, false);
@@ -1028,7 +1028,7 @@ ccp_lattice_meet (ccp_prop_value_t *val1, ccp_prop_value_t *val2)
    of the PHI node that are incoming via executable edges.  */
 
 static enum ssa_prop_result
-ccp_visit_phi_node (gimple phi)
+ccp_visit_phi_node (gphi *phi)
 {
   unsigned i;
   ccp_prop_value_t *old_val, new_val;
@@ -1174,7 +1174,7 @@ ccp_fold (gimple stmt)
     case GIMPLE_SWITCH:
       {
        /* Return the constant switch index.  */
-        return valueize_op (gimple_switch_index (stmt));
+        return valueize_op (gimple_switch_index (as_a <gswitch *> (stmt)));
       }
 
     case GIMPLE_ASSIGN:
@@ -1724,7 +1724,7 @@ evaluate_stmt (gimple stmt)
             simplified = gimple_assign_rhs1 (stmt);
         }
       else if (code == GIMPLE_SWITCH)
-        simplified = gimple_switch_index (stmt);
+        simplified = gimple_switch_index (as_a <gswitch *> (stmt));
       else
        /* These cannot satisfy is_gimple_min_invariant without folding.  */
        gcc_assert (code == GIMPLE_CALL || code == GIMPLE_COND);
@@ -1935,7 +1935,8 @@ static void
 insert_clobber_before_stack_restore (tree saved_val, tree var,
                                     gimple_htab **visited)
 {
-  gimple stmt, clobber_stmt;
+  gimple stmt;
+  gassign *clobber_stmt;
   tree clobber;
   imm_use_iterator iter;
   gimple_stmt_iterator i;
@@ -2094,6 +2095,7 @@ ccp_fold_stmt (gimple_stmt_iterator *gsi)
     {
     case GIMPLE_COND:
       {
+       gcond *cond_stmt = as_a <gcond *> (stmt);
        ccp_prop_value_t val;
        /* Statement evaluation will handle type mismatches in constants
           more gracefully than the final propagation.  This allows us to
@@ -2113,9 +2115,9 @@ ccp_fold_stmt (gimple_stmt_iterator *gsi)
          }
 
        if (integer_zerop (val.value))
-         gimple_cond_make_false (stmt);
+         gimple_cond_make_false (cond_stmt);
        else
-         gimple_cond_make_true (stmt);
+         gimple_cond_make_true (cond_stmt);
 
        return true;
       }
@@ -2600,10 +2602,10 @@ optimize_unreachable (gimple_stmt_iterator i)
       if (is_gimple_debug (stmt))
        continue;
 
-      if (gimple_code (stmt) == GIMPLE_LABEL)
+      if (glabel *label_stmt = dyn_cast <glabel *> (stmt))
        {
          /* Verify we do not need to preserve the label.  */
-         if (FORCED_LABEL (gimple_label_label (stmt)))
+         if (FORCED_LABEL (gimple_label_label (label_stmt)))
            return false;
 
          continue;
@@ -2624,15 +2626,15 @@ optimize_unreachable (gimple_stmt_iterator i)
        continue;
 
       stmt = gsi_stmt (gsi);
-      if (gimple_code (stmt) == GIMPLE_COND)
+      if (gcond *cond_stmt = dyn_cast <gcond *> (stmt))
        {
          if (e->flags & EDGE_TRUE_VALUE)
-           gimple_cond_make_false (stmt);
+           gimple_cond_make_false (cond_stmt);
          else if (e->flags & EDGE_FALSE_VALUE)
-           gimple_cond_make_true (stmt);
+           gimple_cond_make_true (cond_stmt);
          else
            gcc_unreachable ();
-         update_stmt (stmt);
+         update_stmt (cond_stmt);
        }
       else
        {