if (lhs == t)
continue;
+ /* Valueize t. */
+ if (TREE_CODE (t) == SSA_NAME)
+ {
+ tree tmp = SSA_NAME_VALUE (t);
+ t = tmp ? tmp : t;
+ }
+
/* If we have not processed an alternative yet, then set
RHS to this alternative. */
if (rhs == NULL)
{
tree prev_x = NULL, prev_y = NULL;
+ if (tree_swap_operands_p (x, y, false))
+ std::swap (x, y);
+
if (TREE_CODE (x) == SSA_NAME)
prev_x = SSA_NAME_VALUE (x);
if (TREE_CODE (y) == SSA_NAME)
else if (is_gimple_min_invariant (x)
/* ??? When threading over backedges the following is important
for correctness. See PR61757. */
- || (loop_depth_of_name (x) <= loop_depth_of_name (y)))
+ || (loop_depth_of_name (x) < loop_depth_of_name (y)))
prev_x = x, x = y, y = prev_x, prev_x = prev_y;
else if (prev_x && is_gimple_min_invariant (prev_x))
x = y, y = prev_x, prev_x = prev_y;
if (may_optimize_p
&& (TREE_CODE (rhs) == SSA_NAME
|| is_gimple_min_invariant (rhs)))
- {
- if (dump_file && (dump_flags & TDF_DETAILS))
- {
- fprintf (dump_file, "==== ASGN ");
- print_generic_expr (dump_file, lhs, 0);
- fprintf (dump_file, " = ");
- print_generic_expr (dump_file, rhs, 0);
- fprintf (dump_file, "\n");
- }
+ {
+ /* Valueize rhs. */
+ if (TREE_CODE (rhs) == SSA_NAME)
+ {
+ tree tmp = SSA_NAME_VALUE (rhs);
+ rhs = tmp ? tmp : rhs;
+ }
- set_ssa_name_value (lhs, rhs);
- }
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ {
+ fprintf (dump_file, "==== ASGN ");
+ print_generic_expr (dump_file, lhs, 0);
+ fprintf (dump_file, " = ");
+ print_generic_expr (dump_file, rhs, 0);
+ fprintf (dump_file, "\n");
+ }
+
+ set_ssa_name_value (lhs, rhs);
+ }
}
/* Make sure we can propagate &x + CST. */