static bool
check_reduction_path (dump_user_location_t loc, loop_p loop, gphi *phi,
tree loop_arg, code_helper *code,
- vec<std::pair<ssa_op_iter, use_operand_p> > &path)
+ vec<std::pair<ssa_op_iter, use_operand_p> > &path,
+ bool inner_loop_of_double_reduc)
{
auto_bitmap visited;
tree lookfor = PHI_RESULT (phi);
break;
}
/* Check there's only a single stmt the op is used on. For the
- not value-changing tail and the last stmt allow out-of-loop uses.
+ not value-changing tail and the last stmt allow out-of-loop uses,
+ but not when this is the inner loop of a double reduction.
??? We could relax this and handle arbitrary live stmts by
forcing a scalar epilogue for example. */
imm_use_iterator imm_iter;
}
}
else if (!is_gimple_debug (op_use_stmt)
- && (*code != ERROR_MARK
+ && ((*code != ERROR_MARK || inner_loop_of_double_reduc)
|| flow_bb_inside_loop_p (loop,
gimple_bb (op_use_stmt))))
FOR_EACH_IMM_USE_ON_STMT (use_p, imm_iter)
{
auto_vec<std::pair<ssa_op_iter, use_operand_p> > path;
code_helper code_;
- return (check_reduction_path (loc, loop, phi, loop_arg, &code_, path)
+ return (check_reduction_path (loc, loop, phi, loop_arg, &code_, path, false)
&& code_ == code);
}
auto_vec<std::pair<ssa_op_iter, use_operand_p> > path;
code_helper code;
if (check_reduction_path (vect_location, loop, phi, latch_def, &code,
- path))
+ path, inner_loop_of_double_reduc))
{
STMT_VINFO_REDUC_CODE (phi_info) = code;
if (code == COND_EXPR && !nested_in_vect_loop)