[PATCH] Fix PR27151, ICE on valid with -ftree-vectorize
Thu Apr 27 14:12:00 GMT 2006
On Thu, 27 Apr 2006, Richard Guenther wrote:
> 2006-04-27 Richard Guenther <firstname.lastname@example.org>
> PR tree-optimization/27151
> * tree-vect-transform.c (vectorizable_condition): Punt on
> values that have a different type than the condition.
> * gcc.dg/vect/pr27151.c: New testcase.
Hmmm. I agree that this patch disables the problematic vectorizations,
and may be the most suitable fix for the 4.1 branch, but I believe the
intention is to be able to optimize codes such as those in this test
case. The VEC_COND_EXPR tree code isn't documented in c-tree.texi,
but I think a reasonable set of constraints is for it to behave much
like a regular COND_EXPR, where the type of the condition needs not
match the types of the other two operands. Though for vectors they
clearly need to have the same length.
I believe that one source of these problems may be the line:
/* Arguments are ready. create the new vector stmt. */
vec_compare = build2 (TREE_CODE (cond_expr), vectype,
where perhaps this should build a node of type TREE_TYPE (vec_cond_lhs),
instead of vectype. In this case, vectype is V4SF, whilst hopefully
vec_cond_lhs is V4SI or V4QI (though I've not investigated myself)?
Perhaps we should see whether we can recover/salvage this class of
transformation, before commiting to disabling the problematic cases?
It may turn out to be the case that there's also missing infrastructure
in RTL expansion, and elsewhere downstream, in which your patch might
be a less-intrusive fix.
More information about the Gcc-patches