OSDN Git Service

PR/51443
[pf3gnuchains/gcc-fork.git] / gcc / ipa-pure-const.c
index 766c8fc..82e24cf 100644 (file)
@@ -49,12 +49,13 @@ along with GCC; see the file COPYING3.  If not see
 #include "output.h"
 #include "flags.h"
 #include "timevar.h"
-#include "toplev.h"
 #include "diagnostic.h"
 #include "gimple-pretty-print.h"
 #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"
@@ -95,6 +96,11 @@ struct funct_state_d
   bool can_throw;
 };
 
+/* State used when we know nothing about function.  */
+static struct funct_state_d varying_state
+   = { IPA_NEITHER, IPA_NEITHER, true, true, true };
+
+
 typedef struct funct_state_d * funct_state;
 
 /* The storage of the funct_state is abstracted because there is the
@@ -133,7 +139,7 @@ suggest_attribute (int option, tree decl, bool known_finite,
                   struct pointer_set_t *warned_about,
                   const char * attrib_name)
 {
-  if (!option_enabled (option))
+  if (!option_enabled (option, &global_options))
     return warned_about;
   if (TREE_THIS_VOLATILE (decl)
       || (known_finite && function_always_visible_to_compiler_p (decl)))
@@ -177,6 +183,16 @@ warn_function_const (tree decl, bool known_finite)
     = suggest_attribute (OPT_Wsuggest_attribute_const, decl,
                         known_finite, warned_about, "const");
 }
+
+void
+warn_function_noreturn (tree decl)
+{
+  static struct pointer_set_t *warned_about;
+  if (!lang_hooks.missing_noreturn_ok_p (decl))
+    warned_about 
+      = suggest_attribute (OPT_Wsuggest_attribute_noreturn, decl,
+                          true, warned_about, "noreturn");
+}
 /* Init the function state.  */
 
 static void
@@ -202,13 +218,12 @@ has_function_state (struct cgraph_node *node)
 static inline funct_state
 get_function_state (struct cgraph_node *node)
 {
-  static struct funct_state_d varying
-    = { IPA_NEITHER, IPA_NEITHER, true, true, true };
   if (!funct_state_vec
-      || VEC_length (funct_state, funct_state_vec) <= (unsigned int)node->uid)
+      || VEC_length (funct_state, funct_state_vec) <= (unsigned int)node->uid
+      || !VEC_index (funct_state, funct_state_vec, node->uid))
     /* We might want to put correct previously_known state into varying.  */
-    return &varying;
 return VEC_index (funct_state, funct_state_vec, node->uid);
+    return &varying_state;
+ return VEC_index (funct_state, funct_state_vec, node->uid);
 }
 
 /* Set the function state S for NODE.  */
@@ -314,7 +329,7 @@ check_op (funct_state local, tree t, bool checking_write)
       return;
     }
   else if (t
-          && INDIRECT_REF_P (t)
+          && (INDIRECT_REF_P (t) || TREE_CODE (t) == MEM_REF)
           && TREE_CODE (TREE_OPERAND (t, 0)) == SSA_NAME
           && !ptr_deref_may_alias_global_p (TREE_OPERAND (t, 0)))
     {
@@ -410,6 +425,40 @@ worse_state (enum pure_const_state_e *state, bool *looping,
   *looping = MAX (*looping, looping2);
 }
 
+/* Recognize special cases of builtins that are by themselves not pure or const
+   but function using them is.  */
+static bool
+special_builtin_state (enum pure_const_state_e *state, bool *looping,
+                       tree callee)
+{
+  if (DECL_BUILT_IN_CLASS (callee) == BUILT_IN_NORMAL)
+    switch (DECL_FUNCTION_CODE (callee))
+      {
+       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:
+       case BUILT_IN_EH_FILTER:
+       case BUILT_IN_UNWIND_RESUME:
+       case BUILT_IN_CXA_END_CLEANUP:
+       case BUILT_IN_EH_COPY_VALUES:
+       case BUILT_IN_FRAME_ADDRESS:
+       case BUILT_IN_APPLY:
+       case BUILT_IN_APPLY_ARGS:
+         *looping = false;
+         *state = IPA_CONST;
+         return true;
+       case BUILT_IN_PREFETCH:
+         *looping = true;
+         *state = IPA_CONST;
+         return true;
+      }
+  return false;
+}
+
 /* Check the parameters of a function call to CALL_EXPR to see if
    there are any references in the parameters that are not allowed for
    pure or const functions.  Also check to see if this is either an
@@ -460,9 +509,15 @@ check_call (funct_state local, gimple call, bool ipa)
      graph.  */
   if (callee_t)
     {
-      /* built_in_return is really just an return statemnt.  */
-      if (gimple_call_builtin_p (call, BUILT_IN_RETURN))
-       return;
+      enum pure_const_state_e call_state;
+      bool call_looping;
+
+      if (special_builtin_state (&call_state, &call_looping, callee_t))
+       {
+         worse_state (&local->pure_const_state, &local->looping,
+                      call_state, call_looping);
+         return;
+       }
       /* When bad things happen to bad functions, they cannot be const
         or pure.  */
       if (setjmp_call_p (callee_t))
@@ -495,7 +550,7 @@ check_call (funct_state local, gimple call, bool ipa)
         fprintf (dump_file, "    Recursive call can loop.\n");
       local->looping = true;
     }
-  /* Either calle is unknown or we are doing local analysis.
+  /* Either callee is unknown or we are doing local analysis.
      Look to see if there are any bits available for the callee (such as by
      declaration or because it is builtin) and process solely on the basis of
      those bits. */
@@ -587,7 +642,6 @@ static void
 check_stmt (gimple_stmt_iterator *gsip, funct_state local, bool ipa)
 {
   gimple stmt = gsi_stmt (*gsip);
-  unsigned int i = 0;
 
   if (is_gimple_debug (stmt))
     return;
@@ -598,6 +652,13 @@ 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))
+    {
+      local->pure_const_state = IPA_NEITHER;
+      if (dump_file)
+       fprintf (dump_file, "    Volatile stmt is not const/pure\n");
+    }
+
   /* Look for loads and stores.  */
   walk_stmt_load_store_ops (stmt, local,
                            ipa ? check_ipa_load : check_load,
@@ -634,16 +695,12 @@ check_stmt (gimple_stmt_iterator *gsip, funct_state local, bool ipa)
        }
       break;
     case GIMPLE_ASM:
-      for (i = 0; i < gimple_asm_nclobbers (stmt); i++)
+      if (gimple_asm_clobbers_memory_p (stmt))
        {
-         tree op = gimple_asm_clobber_op (stmt, i);
-         if (strcmp (TREE_STRING_POINTER (TREE_VALUE (op)), "memory") == 0)
-           {
-              if (dump_file)
-                fprintf (dump_file, "    memory asm clobber is not const/pure");
-             /* Abandon all hope, ye who enter here. */
-             local->pure_const_state = IPA_NEITHER;
-           }
+         if (dump_file)
+           fprintf (dump_file, "    memory asm clobber is not const/pure");
+         /* Abandon all hope, ye who enter here. */
+         local->pure_const_state = IPA_NEITHER;
        }
       if (gimple_asm_volatile_p (stmt))
        {
@@ -677,6 +734,16 @@ analyze_function (struct cgraph_node *fn, bool ipa)
   l->looping_previously_known = true;
   l->looping = false;
   l->can_throw = false;
+  state_from_flags (&l->state_previously_known, &l->looping_previously_known,
+                   flags_from_decl_or_type (fn->decl),
+                   cgraph_node_cannot_return (fn));
+
+  if (fn->thunk.thunk_p || fn->alias)
+    {
+      /* Thunk gets propagated through, so nothing interesting happens.  */
+      gcc_assert (ipa);
+      return l;
+    }
 
   if (dump_file)
     {
@@ -712,7 +779,7 @@ end:
       if (mark_dfs_back_edges ())
         {
          /* Preheaders are needed for SCEV to work.
-            Simple lateches and recorded exits improve chances that loop will
+            Simple latches and recorded exits improve chances that loop will
             proved to be finite in testcases such as in loop-15.c and loop-24.c  */
          loop_optimizer_init (LOOPS_NORMAL
                               | LOOPS_HAVE_RECORDED_EXITS);
@@ -745,9 +812,6 @@ end:
 
   if (dump_file && (dump_flags & TDF_DETAILS))
     fprintf (dump_file, "    checking previously known:");
-  state_from_flags (&l->state_previously_known, &l->looping_previously_known,
-                   flags_from_decl_or_type (fn->decl),
-                   cgraph_node_cannot_return (fn));
 
   better_state (&l->pure_const_state, &l->looping,
                l->state_previously_known,
@@ -810,7 +874,9 @@ remove_node_data (struct cgraph_node *node, void *data ATTRIBUTE_UNUSED)
 {
   if (has_function_state (node))
     {
-      free (get_function_state (node));
+      funct_state l = get_function_state (node);
+      if (l != &varying_state)
+        free (l);
       set_function_state (node, NULL);
     }
 }
@@ -855,7 +921,7 @@ generate_summary (void)
 
      We process AVAIL_OVERWRITABLE functions.  We can not use the results
      by default, but the info can be used at LTO with -fwhole-program or
-     when function got clonned and the clone is AVAILABLE.  */
+     when function got cloned and the clone is AVAILABLE.  */
 
   for (node = cgraph_nodes; node; node = node->next)
     if (cgraph_function_body_availability (node) >= AVAIL_OVERWRITABLE)
@@ -885,7 +951,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))
@@ -893,7 +959,7 @@ pure_const_write_summary (cgraph_node_set set,
       node = csi_node (csi);
       if (node->analyzed && has_function_state (node))
        {
-         struct bitpack_d *bp;
+         struct bitpack_d bp;
          funct_state fs;
          int node_ref;
          lto_cgraph_encoder_t encoder;
@@ -902,18 +968,17 @@ 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.  */
-         bp = bitpack_create ();
-         bp_pack_value (bp, fs->pure_const_state, 2);
-         bp_pack_value (bp, fs->state_previously_known, 2);
-         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 (ob->main_stream, bp);
-         bitpack_delete (bp);
+         bp = bitpack_create (ob->main_stream);
+         bp_pack_value (&bp, fs->pure_const_state, 2);
+         bp_pack_value (&bp, fs->state_previously_known, 2);
+         bp_pack_value (&bp, fs->looping_previously_known, 1);
+         bp_pack_value (&bp, fs->looping, 1);
+         bp_pack_value (&bp, fs->can_throw, 1);
+         streamer_write_bitpack (&bp);
        }
     }
 
@@ -942,18 +1007,18 @@ 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++)
            {
              unsigned int index;
              struct cgraph_node *node;
-             struct bitpack_d *bp;
+             struct bitpack_d bp;
              funct_state fs;
              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);
@@ -961,14 +1026,14 @@ 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);
+                       = (enum pure_const_state_e) bp_unpack_value (&bp, 2);
              fs->state_previously_known
-                       = (enum pure_const_state_e) bp_unpack_value (bp, 2);
-             fs->looping_previously_known = bp_unpack_value (bp, 1);
-             fs->looping = bp_unpack_value (bp, 1);
-             fs->can_throw = bp_unpack_value (bp, 1);
+                       = (enum pure_const_state_e) bp_unpack_value (&bp, 2);
+             fs->looping_previously_known = bp_unpack_value (&bp, 1);
+             fs->looping = bp_unpack_value (&bp, 1);
+             fs->can_throw = bp_unpack_value (&bp, 1);
              if (dump_file)
                {
                  int flags = flags_from_decl_or_type (node->decl);
@@ -992,7 +1057,6 @@ pure_const_read_summary (void)
                  if (fs->can_throw)
                    fprintf (dump_file,"  function is locally throwing\n");
                }
-             bitpack_delete (bp);
            }
 
          lto_destroy_simple_input_block (file_data,
@@ -1009,14 +1073,16 @@ ignore_edge (struct cgraph_edge *e)
   return (!e->can_throw_external);
 }
 
-/* Return true if NODE is self recursive function.  */
+/* Return true if NODE is self recursive function.
+   ??? self recursive and indirectly recursive funcions should
+   be the same, so this function seems unnecesary.  */
 
 static bool
 self_recursive_p (struct cgraph_node *node)
 {
   struct cgraph_edge *e;
   for (e = node->callees; e; e = e->next_callee)
-    if (e->callee == node)
+    if (cgraph_function_node (e->callee, NULL) == node)
       return true;
   return false;
 }
@@ -1035,11 +1101,11 @@ propagate_pure_const (void)
   int i;
   struct ipa_dfs_info * w_info;
 
-  order_pos = ipa_utils_reduced_inorder (order, true, false, NULL);
+  order_pos = ipa_reduced_postorder (order, true, false, NULL);
   if (dump_file)
     {
       dump_cgraph (dump_file);
-      ipa_utils_print_order(dump_file, "reduced", order, order_pos);
+      ipa_print_order(dump_file, "reduced", order, order_pos);
     }
 
   /* Propagate the local information thru the call graph to produce
@@ -1053,6 +1119,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");
 
@@ -1106,7 +1175,8 @@ propagate_pure_const (void)
          /* Now walk the edges and merge in callee properties.  */
          for (e = w->callees; e; e = e->next_callee)
            {
-             struct cgraph_node *y = e->callee;
+             enum availability avail;
+             struct cgraph_node *y = cgraph_function_node (e->callee, &avail);
              enum pure_const_state_e edge_state = IPA_CONST;
              bool edge_looping = false;
 
@@ -1117,7 +1187,7 @@ propagate_pure_const (void)
                           cgraph_node_name (e->callee),
                           e->callee->uid);
                }
-             if (cgraph_function_body_availability (y) > AVAIL_OVERWRITABLE)
+             if (avail > AVAIL_OVERWRITABLE)
                {
                  funct_state y_l = get_function_state (y);
                  if (dump_file && (dump_flags & TDF_DETAILS))
@@ -1143,10 +1213,13 @@ propagate_pure_const (void)
                      edge_looping = y_l->looping;
                    }
                }
+             else if (special_builtin_state (&edge_state, &edge_looping,
+                                              y->decl))
+               ;
              else
                state_from_flags (&edge_state, &edge_looping,
-                                 flags_from_decl_or_type (y->decl),
-                                 cgraph_edge_cannot_lead_to_return (e));
+                                 flags_from_decl_or_type (y->decl),
+                                 cgraph_edge_cannot_lead_to_return (e));
 
              /* Merge the results with what we already know.  */
              better_state (&edge_state, &edge_looping,
@@ -1161,7 +1234,7 @@ propagate_pure_const (void)
            break;
 
          /* Now process the indirect call.  */
-          for (ie = node->indirect_calls; ie; ie = ie->next_callee)
+          for (ie = w->indirect_calls; ie; ie = ie->next_callee)
            {
              enum pure_const_state_e edge_state = IPA_CONST;
              bool edge_looping = false;
@@ -1184,7 +1257,7 @@ propagate_pure_const (void)
            break;
 
          /* And finally all loads and stores.  */
-         for (i = 0; ipa_ref_list_reference_iterate (&node->ref_list, i, ref); i++)
+         for (i = 0; ipa_ref_list_reference_iterate (&w->ref_list, i, ref); i++)
            {
              enum pure_const_state_e ref_state = IPA_CONST;
              bool ref_looping = false;
@@ -1259,8 +1332,7 @@ propagate_pure_const (void)
                             this_looping ? "looping " : "",
                             cgraph_node_name (w));
                }
-             cgraph_set_readonly_flag (w, true);
-             cgraph_set_looping_const_or_pure_flag (w, this_looping);
+             cgraph_set_const_flag (w, true, this_looping);
              break;
 
            case IPA_PURE:
@@ -1272,8 +1344,7 @@ propagate_pure_const (void)
                             this_looping ? "looping " : "",
                             cgraph_node_name (w));
                }
-             cgraph_set_pure_flag (w, true);
-             cgraph_set_looping_const_or_pure_flag (w, this_looping);
+             cgraph_set_pure_flag (w, true, this_looping);
              break;
 
            default:
@@ -1284,18 +1355,7 @@ propagate_pure_const (void)
        }
     }
 
-  /* Cleanup. */
-  for (node = cgraph_nodes; node; node = node->next)
-    {
-      /* Get rid of the aux information.  */
-      if (node->aux)
-       {
-         w_info = (struct ipa_dfs_info *) node->aux;
-         free (node->aux);
-         node->aux = NULL;
-       }
-    }
-
+  ipa_free_postorder_info ();
   free (order);
 }
 
@@ -1313,11 +1373,11 @@ propagate_nothrow (void)
   int i;
   struct ipa_dfs_info * w_info;
 
-  order_pos = ipa_utils_reduced_inorder (order, true, false, ignore_edge);
+  order_pos = ipa_reduced_postorder (order, true, false, ignore_edge);
   if (dump_file)
     {
       dump_cgraph (dump_file);
-      ipa_utils_print_order(dump_file, "reduced for nothrow", order, order_pos);
+      ipa_print_order (dump_file, "reduced for nothrow", order, order_pos);
     }
 
   /* Propagate the local information thru the call graph to produce
@@ -1329,6 +1389,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)
@@ -1345,9 +1408,10 @@ propagate_nothrow (void)
 
          for (e = w->callees; e; e = e->next_callee)
            {
-             struct cgraph_node *y = e->callee;
+             enum availability avail;
+             struct cgraph_node *y = cgraph_function_node (e->callee, &avail);
 
-             if (cgraph_function_body_availability (y) > AVAIL_OVERWRITABLE)
+             if (avail > AVAIL_OVERWRITABLE)
                {
                  funct_state y_l = get_function_state (y);
 
@@ -1375,10 +1439,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));
@@ -1390,18 +1451,7 @@ propagate_nothrow (void)
        }
     }
 
-  /* Cleanup. */
-  for (node = cgraph_nodes; node; node = node->next)
-    {
-      /* Get rid of the aux information.  */
-      if (node->aux)
-       {
-         w_info = (struct ipa_dfs_info *) node->aux;
-         free (node->aux);
-         node->aux = NULL;
-       }
-    }
-
+  ipa_free_postorder_info ();
   free (order);
 }
 
@@ -1485,7 +1535,7 @@ skip_function_for_local_pure_const (struct cgraph_node *node)
   if (cgraph_function_body_availability (node) <= AVAIL_OVERWRITABLE)
     {
       if (dump_file)
-        fprintf (dump_file, "Function is not available or overwrittable; not analyzing.\n");
+        fprintf (dump_file, "Function is not available or overwritable; not analyzing.\n");
       return true;
     }
   return false;
@@ -1503,22 +1553,20 @@ local_pure_const (void)
   bool skip;
   struct cgraph_node *node;
 
-  node = cgraph_node (current_function_decl);
+  node = cgraph_get_node (current_function_decl);
   skip = skip_function_for_local_pure_const (node);
   if (!warn_suggest_attribute_const
       && !warn_suggest_attribute_pure
       && skip)
     return 0;
 
-  /* First do NORETURN discovery.  */
+  l = analyze_function (node, false);
+
+  /* Do NORETURN discovery.  */
   if (!skip && !TREE_THIS_VOLATILE (current_function_decl)
       && EDGE_COUNT (EXIT_BLOCK_PTR->preds) == 0)
     {
-      if (warn_missing_noreturn
-         && !lang_hooks.missing_noreturn_ok_p (cfun->decl))
-       warning_at (DECL_SOURCE_LOCATION (cfun->decl), OPT_Wmissing_noreturn,
-                   "function might be possible candidate "
-                   "for attribute %<noreturn%>");
+      warn_function_noreturn (cfun->decl);
       if (dump_file)
         fprintf (dump_file, "Function found to be noreturn: %s\n",
                 lang_hooks.decl_printable_name (current_function_decl, 2));
@@ -1530,7 +1578,6 @@ local_pure_const (void)
 
       changed = true;
     }
-  l = analyze_function (node, false);
 
   switch (l->pure_const_state)
     {
@@ -1540,8 +1587,7 @@ local_pure_const (void)
          warn_function_const (current_function_decl, !l->looping);
          if (!skip)
            {
-             cgraph_set_readonly_flag (node, true);
-             cgraph_set_looping_const_or_pure_flag (node, l->looping);
+             cgraph_set_const_flag (node, true, l->looping);
              changed = true;
            }
          if (dump_file)
@@ -1555,7 +1601,7 @@ local_pure_const (void)
        {
          if (!skip)
            {
-             cgraph_set_looping_const_or_pure_flag (node, false);
+             cgraph_set_const_flag (node, true, false);
              changed = true;
            }
          if (dump_file)
@@ -1570,8 +1616,7 @@ local_pure_const (void)
        {
          if (!skip)
            {
-             cgraph_set_pure_flag (node, true);
-             cgraph_set_looping_const_or_pure_flag (node, l->looping);
+             cgraph_set_pure_flag (node, true, l->looping);
              changed = true;
            }
          warn_function_pure (current_function_decl, !l->looping);
@@ -1586,7 +1631,7 @@ local_pure_const (void)
        {
          if (!skip)
            {
-             cgraph_set_looping_const_or_pure_flag (node, false);
+             cgraph_set_pure_flag (node, true, false);
              changed = true;
            }
          if (dump_file)
@@ -1601,19 +1646,14 @@ 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",
                 lang_hooks.decl_printable_name (current_function_decl,
                                                 2));
     }
-  if (l)
-    free (l);
+  free (l);
   if (changed)
     return execute_fixup_cfg ();
   else