summaryrefslogtreecommitdiff
path: root/gcc/tree-ssa-copyrename.c
diff options
context:
space:
mode:
authordnovillo <dnovillo@138bc75d-0d04-0410-961f-82ee72b054a4>2004-07-24 01:05:45 +0000
committerdnovillo <dnovillo@138bc75d-0d04-0410-961f-82ee72b054a4>2004-07-24 01:05:45 +0000
commitcbbefea46e5a749a5182df5770cc70f30e12aa2e (patch)
tree152cb570bb5673abd6f3cb0e91129d27c8889d40 /gcc/tree-ssa-copyrename.c
parent1f63eb0c40acb3350bb371130e878bf7156266a7 (diff)
downloadgcc-cbbefea46e5a749a5182df5770cc70f30e12aa2e.tar.gz
PR tree-optimization/16688
PR tree-optimization/16689 * tree-ssa-alias.c (setup_pointers_and_addressables): Remove unnecessary initialization of 'tag'. (get_tmt_for): Check that the new type tag has the same alias set as the pointed-to type. (group_aliases): Only regular variables need to be removed from the alias set of a name tag. * tree-ssa-copy.c (may_propagate_copy): Do not allow copy propagation if the two types are not compatible. (merge_alias_info): Rename from replace_ssa_names_ann. Add more checking. (replace_exp_1): If both arguments are SSA_NAMEs, check that the propagation can be done. Only call merge_alias_info on pointers. (propagate_value): Likewise. * tree-ssa-copyrename.c: Include langhooks.h. (copy_rename_partition_coalesce): Call replace_ssa_name_symbol to do the merging. Do not coalesce variables with incompatible types. (rename_ssa_copies): Call replace_ssa_name_symbol. * tree-ssa.c (verify_ssa_name): Verify that the SSA_NAME has the same type as the underlying _DECL. * tree-ssanames.c (replace_ssa_name_symbol): New function. * tree.h (replace_ssa_name_symbol): Declare. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@85108 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-ssa-copyrename.c')
-rw-r--r--gcc/tree-ssa-copyrename.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/gcc/tree-ssa-copyrename.c b/gcc/tree-ssa-copyrename.c
index c65b8284de6..ac7c00aa06e 100644
--- a/gcc/tree-ssa-copyrename.c
+++ b/gcc/tree-ssa-copyrename.c
@@ -38,6 +38,7 @@ Boston, MA 02111-1307, USA. */
#include "tree-dump.h"
#include "tree-ssa-live.h"
#include "tree-pass.h"
+#include "langhooks.h"
extern void rename_ssa_copies (void);
@@ -247,16 +248,24 @@ copy_rename_partition_coalesce (var_map map, tree var1, tree var2, FILE *debug)
gimp2 = false;
}
+ /* Don't coalesce if the two variables aren't type compatible. */
+ if (!lang_hooks.types_compatible_p (TREE_TYPE (root1), TREE_TYPE (root2)))
+ {
+ if (debug)
+ fprintf (debug, " : Incompatible types. No coalesce.\n");
+ return;
+ }
+
/* Merge the two partitions. */
p3 = partition_union (map->var_partition, p1, p2);
/* Set the root variable of the partition to the better choice, if there is
one. */
if (!gimp2)
- SSA_NAME_VAR (partition_to_var (map, p3)) = root2;
+ replace_ssa_name_symbol (partition_to_var (map, p3), root2);
else
if (!gimp1)
- SSA_NAME_VAR (partition_to_var (map, p3)) = root1;
+ replace_ssa_name_symbol (partition_to_var (map, p3), root1);
/* Update the various flag widgitry of the current base representative. */
ann3 = var_ann (SSA_NAME_VAR (partition_to_var (map, p3)));
@@ -359,7 +368,7 @@ rename_ssa_copies (void)
fprintf (debug, "\n");
}
}
- SSA_NAME_VAR (var) = SSA_NAME_VAR (part_var);
+ replace_ssa_name_symbol (var, SSA_NAME_VAR (part_var));
}
delete_var_map (map);