OSDN Git Service

2010-04-15 Richard Guenther <rguenther@suse.de>
[pf3gnuchains/gcc-fork.git] / gcc / ipa-type-escape.c
index 0c8d229..0807d0b 100644 (file)
@@ -1,6 +1,6 @@
 /* Type based alias analysis.
-   Copyright (C) 2004, 2005, 2006, 2007, 2008 Free Software Foundation,
-   Inc.
+   Copyright (C) 2004, 2005, 2006, 2007, 2008, 2010
+   Free Software Foundation, Inc.
    Contributed by Kenneth Zadeck <zadeck@naturalbridge.com>
 
 This file is part of GCC.
@@ -1072,7 +1072,7 @@ has_proper_scope_for_analysis (tree t)
   tree type = get_canon_type (TREE_TYPE (t), false, false);
   if (!type) return;
 
-  if (lookup_attribute ("used", DECL_ATTRIBUTES (t)))
+  if (DECL_PRESERVE_P (t))
     {
       mark_interesting_type (type, FULL_ESCAPE);
       return;
@@ -1340,7 +1340,8 @@ check_call (gimple call)
       if (TYPE_ARG_TYPES (TREE_TYPE (callee_t)))
        {
          for (arg_type = TYPE_ARG_TYPES (TREE_TYPE (callee_t)), i = 0;
-              arg_type && TREE_VALUE (arg_type) != void_type_node;
+              arg_type && TREE_VALUE (arg_type) != void_type_node
+              && i < gimple_call_num_args (call);
               arg_type = TREE_CHAIN (arg_type), i++)
            {
              tree operand = gimple_call_arg (call, i);
@@ -1362,7 +1363,7 @@ check_call (gimple call)
             have to do this; the front ends should always process
             the arg list from the TYPE_ARG_LIST. */
          for (arg_type = DECL_ARGUMENTS (callee_t), i = 0;
-              arg_type;
+              arg_type && i < gimple_call_num_args (call);
               arg_type = TREE_CHAIN (arg_type), i++)
            {
              tree operand = gimple_call_arg (call, i);
@@ -1984,7 +1985,7 @@ type_escape_execute (void)
      they may cause a type variable to escape.
   */
   for (node = cgraph_nodes; node; node = node->next)
-    if (node->analyzed)
+    if (node->analyzed && !node->clone_of)
       analyze_function (node);