@@ -63,6 +63,7 @@ along with GCC; see the file COPYING3. If not see
#include "diagnostic-core.h" /* for fnotice */
#include "stringpool.h"
#include "attribs.h"
+#include "tree-ssa-coalesce.h"
using namespace gcc;
@@ -2044,9 +2045,16 @@ execute_function_todo (function *fn, void *data)
verify_gimple_in_seq (gimple_body (cfun->decl));
}
if (cfun->curr_properties & PROP_ssa)
- /* IPA passes leave stmts to be fixed up, so make sure to
- not verify SSA operands whose verifier will choke on that. */
- verify_ssa (true, !from_ipa_pass);
+ {
+ /* IPA passes leave stmts to be fixed up, so make sure to
+ not verify SSA operands whose verifier will choke on that. */
+ verify_ssa (true, !from_ipa_pass);
+#if 0
+ /* If you want to debug a SSA coalescing issue, uncomment. */
+ if (!from_ipa_pass)
+ verify_ssa_coalescing ();
+#endif
+ }
/* IPA passes leave basic-blocks unsplit, so make sure to
not trip on that. */
if ((cfun->curr_properties & PROP_cfg)
@@ -1017,7 +1017,7 @@ coalesce_with_default (tree var, coalesce_list *cl, bitmap used_in_copy)
return;
tree ssa = ssa_default_def (cfun, SSA_NAME_VAR (var));
- if (!has_zero_uses (ssa))
+ if (!ssa || !has_zero_uses (ssa))
return;
add_cost_one_coalesce (cl, SSA_NAME_VERSION (ssa), SSA_NAME_VERSION (var));
@@ -1124,8 +1124,8 @@ create_coalesce_list_for_region (var_map map, bitmap used_in_copy)
if (!rhs1)
break;
tree lhs = ssa_default_def (cfun, res);
- gcc_assert (lhs);
- if (TREE_CODE (rhs1) == SSA_NAME
+ if (lhs
+ && TREE_CODE (rhs1) == SSA_NAME
&& gimple_can_coalesce_p (lhs, rhs1))
{
v1 = SSA_NAME_VERSION (lhs);
@@ -1759,3 +1759,12 @@ coalesce_ssa_name (var_map map)
ssa_conflicts_delete (graph);
}
+/* Verify that we can coalesce SSA names we must coalesce. */
+
+DEBUG_FUNCTION void
+verify_ssa_coalescing (void)
+{
+ var_map map = init_var_map (num_ssa_names);
+ coalesce_ssa_name (map);
+ delete_var_map (map);
+}
@@ -22,5 +22,6 @@ along with GCC; see the file COPYING3. If not see
extern void coalesce_ssa_name (var_map);
extern bool gimple_can_coalesce_p (tree, tree);
+extern void verify_ssa_coalescing (void);
#endif /* GCC_TREE_SSA_COALESCE_H */