return cfg_cleanup_needed;
}
-/* Return true if OPERAND is defined by a PHI node which uses the LHS
- of STMT in it's operands. This is also known as a "destructive
- update" operation. */
-
-static bool
-is_phi_for_stmt (gimple *stmt, tree operand)
-{
- gimple *def_stmt;
- gphi *def_phi;
- tree lhs;
- use_operand_p arg_p;
- ssa_op_iter i;
-
- if (TREE_CODE (operand) != SSA_NAME)
- return false;
-
- lhs = gimple_assign_lhs (stmt);
-
- def_stmt = SSA_NAME_DEF_STMT (operand);
- def_phi = dyn_cast <gphi *> (def_stmt);
- if (!def_phi)
- return false;
-
- FOR_EACH_PHI_ARG (arg_p, def_phi, i, SSA_OP_USE)
- if (lhs == USE_FROM_PTR (arg_p))
- return true;
- return false;
-}
-
/* Remove def stmt of VAR if VAR has zero uses and recurse
on rhs1 operand if so. */
swaps two operands if it is profitable for binary operation
consuming OPINDEX + 1 abnd OPINDEX + 2 operands.
- We pair ops with the same rank if possible.
-
- The alternative we try is to see if STMT is a destructive
- update style statement, which is like:
- b = phi (a, ...)
- a = c + b;
- In that case, we want to use the destructive update form to
- expose the possible vectorizer sum reduction opportunity.
- In that case, the third operand will be the phi node. This
- check is not performed if STMT is null.
-
- We could, of course, try to be better as noted above, and do a
- lot of work to try to find these opportunities in >3 operand
- cases, but it is unlikely to be worth it. */
+ We pair ops with the same rank if possible. */
static void
swap_ops_for_binary_stmt (const vec<operand_entry *> &ops,
- unsigned int opindex, gimple *stmt)
+ unsigned int opindex)
{
operand_entry *oe1, *oe2, *oe3;
oe2 = ops[opindex + 1];
oe3 = ops[opindex + 2];
- if ((oe1->rank == oe2->rank
- && oe2->rank != oe3->rank)
- || (stmt && is_phi_for_stmt (stmt, oe3->op)
- && !is_phi_for_stmt (stmt, oe1->op)
- && !is_phi_for_stmt (stmt, oe2->op)))
+ if (oe1->rank == oe2->rank && oe2->rank != oe3->rank)
std::swap (*oe1, *oe3);
- else if ((oe1->rank == oe3->rank
- && oe2->rank != oe3->rank)
- || (stmt && is_phi_for_stmt (stmt, oe2->op)
- && !is_phi_for_stmt (stmt, oe1->op)
- && !is_phi_for_stmt (stmt, oe3->op)))
+ else if (oe1->rank == oe3->rank && oe2->rank != oe3->rank)
std::swap (*oe1, *oe2);
}
else
{
if (op_index > 1)
- swap_ops_for_binary_stmt (ops, op_index - 2, NULL);
+ swap_ops_for_binary_stmt (ops, op_index - 2);
operand_entry *oe2 = ops[op_index--];
operand_entry *oe1 = ops[op_index--];
op2 = oe2->op;
binary op are chosen wisely. */
int len = ops.length ();
if (len >= 3)
- swap_ops_for_binary_stmt (ops, len - 3, stmt);
+ swap_ops_for_binary_stmt (ops, len - 3);
new_lhs = rewrite_expr_tree (stmt, rhs_code, 0, ops,
powi_result != NULL