#include "diagnostic.h"
#include "bitmap.h"
#include "tree-flow.h"
-#include "tree-simple.h"
+#include "tree-gimple.h"
#include "tree-inline.h"
#include "timevar.h"
#include "tree-alias-common.h"
#include "tree-dump.h"
#include "tree-ssa-live.h"
#include "tree-pass.h"
+#include "langhooks.h"
extern void rename_ssa_copies (void);
return;
}
+ if ((TREE_CODE (root1) == RESULT_DECL) != (TREE_CODE (root2) == RESULT_DECL))
+ {
+ if (debug)
+ fprintf (debug, " : One root a RESULT_DECL. No coalesce.\n");
+ return;
+ }
+
gimp1 = is_gimple_tmp_var (root1);
gimp2 = is_gimple_tmp_var (root2);
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)));
else
debug = NULL;
- map = init_var_map (highest_ssa_version + 1);
+ map = init_var_map (num_ssa_names + 1);
FOR_EACH_BB (bb)
{
tree lhs = TREE_OPERAND (stmt, 0);
tree rhs = TREE_OPERAND (stmt, 1);
- if (TREE_CODE (lhs) == SSA_NAME
- && !has_hidden_use (SSA_NAME_VAR (lhs))
- && TREE_CODE (rhs) == SSA_NAME)
+ if (TREE_CODE (lhs) == SSA_NAME && TREE_CODE (rhs) == SSA_NAME)
copy_rename_partition_coalesce (map, lhs, rhs, debug);
}
}
FOR_EACH_BB (bb)
{
/* Treat PHI nodes as copies between the result and each argument. */
- for (phi = phi_nodes (bb); phi; phi = TREE_CHAIN (phi))
+ for (phi = phi_nodes (bb); phi; phi = PHI_CHAIN (phi))
{
int i;
tree res = PHI_RESULT (phi);
- /* Do not process virtual SSA_NAMES or variables which have
- hidden uses. */
- if (!is_gimple_reg (SSA_NAME_VAR (res))
- || has_hidden_use (SSA_NAME_VAR (res)))
+ /* Do not process virtual SSA_NAMES. */
+ if (!is_gimple_reg (SSA_NAME_VAR (res)))
continue;
for (i = 0; i < PHI_NUM_ARGS (phi); i++)
/* Now one more pass to make all elements of a partition share the same
root variable. */
- for (x = 1; x <= highest_ssa_version; x++)
+ for (x = 1; x <= num_ssa_names; x++)
{
part_var = partition_to_var (map, x);
if (!part_var)
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);
NULL, /* next */
0, /* static_pass_number */
TV_TREE_COPY_RENAME, /* tv_id */
- PROP_cfg | PROP_ssa, /* properties_required */
+ PROP_cfg | PROP_ssa | PROP_alias, /* properties_required */
0, /* properties_provided */
0, /* properties_destroyed */
0, /* todo_flags_start */