OSDN Git Service

2012-04-13 Tom de Vries <tom@codesourcery.com>
[pf3gnuchains/gcc-fork.git] / gcc / ipa-pure-const.c
index b56e48a..e8b21f9 100644 (file)
@@ -54,6 +54,8 @@ along with GCC; see the file COPYING3.  If not see
 #include "langhooks.h"
 #include "target.h"
 #include "lto-streamer.h"
+#include "data-streamer.h"
+#include "tree-streamer.h"
 #include "cfgloop.h"
 #include "tree-scalar-evolution.h"
 #include "intl.h"
@@ -435,6 +437,7 @@ special_builtin_state (enum pure_const_state_e *state, bool *looping,
        case BUILT_IN_RETURN:
        case BUILT_IN_UNREACHABLE:
        case BUILT_IN_ALLOCA:
+       case BUILT_IN_ALLOCA_WITH_ALIGN:
        case BUILT_IN_STACK_SAVE:
        case BUILT_IN_STACK_RESTORE:
        case BUILT_IN_EH_POINTER:
@@ -649,7 +652,8 @@ check_stmt (gimple_stmt_iterator *gsip, funct_state local, bool ipa)
       print_gimple_stmt (dump_file, stmt, 0, 0);
     }
 
-  if (gimple_has_volatile_ops (stmt))
+  if (gimple_has_volatile_ops (stmt)
+      && !gimple_clobber_p (stmt))
     {
       local->pure_const_state = IPA_NEITHER;
       if (dump_file)
@@ -948,7 +952,7 @@ pure_const_write_summary (cgraph_node_set set,
        count++;
     }
 
-  lto_output_uleb128_stream (ob->main_stream, count);
+  streamer_write_uhwi_stream (ob->main_stream, count);
 
   /* Process all of the functions.  */
   for (csi = csi_start (set); !csi_end_p (csi); csi_next (&csi))
@@ -965,7 +969,7 @@ pure_const_write_summary (cgraph_node_set set,
 
          encoder = ob->decl_state->cgraph_node_encoder;
          node_ref = lto_cgraph_encoder_encode (encoder, node);
-         lto_output_uleb128_stream (ob->main_stream, node_ref);
+         streamer_write_uhwi_stream (ob->main_stream, node_ref);
 
          /* Note that flags will need to be read in the opposite
             order as we are pushing the bitflags into FLAGS.  */
@@ -975,7 +979,7 @@ pure_const_write_summary (cgraph_node_set set,
          bp_pack_value (&bp, fs->looping_previously_known, 1);
          bp_pack_value (&bp, fs->looping, 1);
          bp_pack_value (&bp, fs->can_throw, 1);
-         lto_output_bitpack (&bp);
+         streamer_write_bitpack (&bp);
        }
     }
 
@@ -1004,7 +1008,7 @@ pure_const_read_summary (void)
       if (ib)
        {
          unsigned int i;
-         unsigned int count = lto_input_uleb128 (ib);
+         unsigned int count = streamer_read_uhwi (ib);
 
          for (i = 0; i < count; i++)
            {
@@ -1015,7 +1019,7 @@ pure_const_read_summary (void)
              lto_cgraph_encoder_t encoder;
 
              fs = XCNEW (struct funct_state_d);
-             index = lto_input_uleb128 (ib);
+             index = streamer_read_uhwi (ib);
              encoder = file_data->cgraph_node_encoder;
              node = lto_cgraph_encoder_deref (encoder, index);
              set_function_state (node, fs);
@@ -1023,7 +1027,7 @@ pure_const_read_summary (void)
              /* Note that the flags must be read in the opposite
                 order in which they were written (the bitflags were
                 pushed into FLAGS).  */
-             bp = lto_input_bitpack (ib);
+             bp = streamer_read_bitpack (ib);
              fs->pure_const_state
                        = (enum pure_const_state_e) bp_unpack_value (&bp, 2);
              fs->state_previously_known
@@ -1116,6 +1120,9 @@ propagate_pure_const (void)
       int count = 0;
       node = order[i];
 
+      if (node->alias)
+       continue;
+
       if (dump_file && (dump_flags & TDF_DETAILS))
        fprintf (dump_file, "Starting cycle\n");
 
@@ -1383,6 +1390,9 @@ propagate_nothrow (void)
       bool can_throw = false;
       node = order[i];
 
+      if (node->alias)
+       continue;
+
       /* Find the worst state for any node in the cycle.  */
       w = node;
       while (w)
@@ -1430,10 +1440,7 @@ propagate_nothrow (void)
          funct_state w_l = get_function_state (w);
          if (!can_throw && !TREE_NOTHROW (w->decl))
            {
-             struct cgraph_edge *e;
              cgraph_set_nothrow_flag (w, true);
-             for (e = w->callers; e; e = e->next_caller)
-               e->can_throw_external = false;
              if (dump_file)
                fprintf (dump_file, "Function found to be nothrow: %s\n",
                         cgraph_node_name (w));
@@ -1640,11 +1647,7 @@ local_pure_const (void)
     }
   if (!l->can_throw && !TREE_NOTHROW (current_function_decl))
     {
-      struct cgraph_edge *e;
-
       cgraph_set_nothrow_flag (node, true);
-      for (e = node->callers; e; e = e->next_caller)
-       e->can_throw_external = false;
       changed = true;
       if (dump_file)
        fprintf (dump_file, "Function found to be nothrow: %s\n",