OSDN Git Service

2009-05-12 Paolo Bonzini <bonzini@gnu.org>
[pf3gnuchains/gcc-fork.git] / gcc / tree-ssa.c
index edbae39..10f8482 100644 (file)
@@ -961,12 +961,9 @@ useless_type_conversion_p_1 (tree outer_type, tree inner_type)
          && TYPE_VOLATILE (TREE_TYPE (outer_type)))
        return false;
 
-      /* Do not lose casts between pointers with different
-        TYPE_REF_CAN_ALIAS_ALL setting or alias sets.  */
-      if ((TYPE_REF_CAN_ALIAS_ALL (inner_type)
-          != TYPE_REF_CAN_ALIAS_ALL (outer_type))
-         || (get_alias_set (TREE_TYPE (inner_type))
-             != get_alias_set (TREE_TYPE (outer_type))))
+      /* Do not lose casts between pointers that when dereferenced access
+        memory with different alias sets.  */
+      if (get_deref_alias_set (inner_type) != get_deref_alias_set (outer_type))
        return false;
 
       /* We do not care for const qualification of the pointed-to types
@@ -1002,6 +999,13 @@ useless_type_conversion_p_1 (tree outer_type, tree inner_type)
       if (TREE_CODE (inner_type) != TREE_CODE (outer_type))
        return false;
 
+      /* Conversions from array types with unknown extent to
+        array types with known extent are not useless.  */
+      if (TREE_CODE (inner_type) == ARRAY_TYPE
+         && !TYPE_DOMAIN (inner_type)
+         && TYPE_DOMAIN (outer_type))
+       return false;
+
       /* ???  This seems to be necessary even for aggregates that don't
         have TYPE_STRUCTURAL_EQUALITY_P set.  */
 
@@ -1514,14 +1518,20 @@ execute_update_addresses_taken (bool do_optimize)
             a local decl that requires not to be a gimple register.  */
          if (code == GIMPLE_ASSIGN || code == GIMPLE_CALL)
            {
-             tree lhs = gimple_get_lhs (stmt);
-             /* A plain decl does not need it set.  */
-             if (lhs && handled_component_p (lhs))
-               {
-                 var = get_base_address (lhs);
-                 if (DECL_P (var))
-                   bitmap_set_bit (not_reg_needs, DECL_UID (var));
-               }
+              tree lhs = gimple_get_lhs (stmt);
+              
+              /* We may not rewrite TMR_SYMBOL to SSA.  */
+              if (lhs && TREE_CODE (lhs) == TARGET_MEM_REF
+                  && TMR_SYMBOL (lhs))
+                bitmap_set_bit (not_reg_needs, DECL_UID (TMR_SYMBOL (lhs)));
+
+              /* A plain decl does not need it set.  */
+              else if (lhs && handled_component_p (lhs))
+                {
+                  var = get_base_address (lhs);
+                  if (DECL_P (var))
+                    bitmap_set_bit (not_reg_needs, DECL_UID (var));
+                }
            }
        }