+2016-06-25 Jakub Jelinek <jakub@redhat.com>
+
+ PR tree-optimization/71631
+ * tree-ssa-reassoc.c (reassociate_bb): Pass true as last argument
+ to rewrite_expr_tree even if negate_result, move new_lhs var
+ declaration and initialization earlier, for powi_result set afterwards
+ new_lhs to lhs. For negate_result, use new_lhs instead of tmp
+ if new_lhs != lhs, and don't shadow gsi var.
+
2016-06-24 Jan Hubicka <hubicka@ucw.cz>
* predict.c (predict_paths_leading_to, predict_paths_leading_to_edge):
}
}
+ tree new_lhs = lhs;
/* If the operand vector is now empty, all operands were
consumed by the __builtin_powi optimization. */
if (ops.length () == 0)
machine_mode mode = TYPE_MODE (TREE_TYPE (lhs));
int ops_num = ops.length ();
int width = get_reassociation_width (ops_num, rhs_code, mode);
- tree new_lhs = lhs;
if (dump_file && (dump_flags & TDF_DETAILS))
fprintf (dump_file,
swap_ops_for_binary_stmt (ops, len - 3, stmt);
new_lhs = rewrite_expr_tree (stmt, 0, ops,
- powi_result != NULL);
+ powi_result != NULL
+ || negate_result);
}
/* If we combined some repeated factors into a
gimple_set_lhs (lhs_stmt, target_ssa);
update_stmt (lhs_stmt);
if (lhs != new_lhs)
- target_ssa = new_lhs;
+ {
+ target_ssa = new_lhs;
+ new_lhs = lhs;
+ }
mul_stmt = gimple_build_assign (lhs, MULT_EXPR,
powi_result, target_ssa);
gimple_set_location (mul_stmt, gimple_location (stmt));
stmt = SSA_NAME_DEF_STMT (lhs);
tree tmp = make_ssa_name (TREE_TYPE (lhs));
gimple_set_lhs (stmt, tmp);
+ if (lhs != new_lhs)
+ tmp = new_lhs;
gassign *neg_stmt = gimple_build_assign (lhs, NEGATE_EXPR,
tmp);
gimple_set_uid (neg_stmt, gimple_uid (stmt));
- gimple_stmt_iterator gsi = gsi_for_stmt (stmt);
gsi_insert_after (&gsi, neg_stmt, GSI_NEW_STMT);
update_stmt (stmt);
}