Created attachment 24569 [details] C source code I just tried to compile the groona-1.2.2 package with the latest trunk snapshot 20110618 on an AMD x86_64 box. The compiler said io.c: In function 'grn_io_create_with_array': io.c:287:13: internal compiler error: in expand_widen_pattern_expr, at optabs.c:535 Please submit a full bug report, with preprocessed source if appropriate. See <http://gcc.gnu.org/bugs.html> for instructions. Preprocessed source code attached. Flag -O3 required.
It is caused by revision 174735: http://gcc.gnu.org/ml/gcc-cvs/2011-06/msg00223.html
I am testing this patch: Index: tree-vect-loop.c =================================================================== --- tree-vect-loop.c (revision 175238) +++ tree-vect-loop.c (working copy) @@ -4591,6 +4591,29 @@ vectorizable_reduction (gimple stmt, gim return false; } + /* In case of widenning multiplication by a constant, we update the type + of the constant to be the type of the other operand. We check that the + constant fits the type in the pattern recognition pass. */ + if (code == DOT_PROD_EXPR + && !types_compatible_p (TREE_TYPE (ops[0]), TREE_TYPE (ops[1]))) + { + if (TREE_CODE (ops[0]) == INTEGER_CST) + ops[0] = build_int_cst_wide (TREE_TYPE (ops[1]), + TREE_INT_CST_LOW (ops[0]), + TREE_INT_CST_HIGH (ops[0])); + else if (TREE_CODE (ops[1]) == INTEGER_CST) + ops[1] = build_int_cst_wide (TREE_TYPE (ops[0]), + TREE_INT_CST_LOW (ops[1]), + TREE_INT_CST_HIGH (ops[1])); + else + { + if (vect_print_dump_info (REPORT_DETAILS)) + fprintf (vect_dump, "invalid types in dot-prod"); + + return false; + } + } + if (!vec_stmt) /* transformation not required. */ { if (!vect_model_reduction_cost (stmt_info, epilog_reduc_code, ncopies))
(In reply to comment #2) > I am testing this patch: > > Index: tree-vect-loop.c > =================================================================== > --- tree-vect-loop.c (revision 175238) > +++ tree-vect-loop.c (working copy) > @@ -4591,6 +4591,29 @@ vectorizable_reduction (gimple stmt, gim > return false; > } > > + /* In case of widenning multiplication by a constant, we update the type > + of the constant to be the type of the other operand. We check that the > + constant fits the type in the pattern recognition pass. */ > + if (code == DOT_PROD_EXPR > + && !types_compatible_p (TREE_TYPE (ops[0]), TREE_TYPE (ops[1]))) > + { > + if (TREE_CODE (ops[0]) == INTEGER_CST) > + ops[0] = build_int_cst_wide (TREE_TYPE (ops[1]), > + TREE_INT_CST_LOW (ops[0]), > + TREE_INT_CST_HIGH (ops[0])); > + else if (TREE_CODE (ops[1]) == INTEGER_CST) > + ops[1] = build_int_cst_wide (TREE_TYPE (ops[0]), > + TREE_INT_CST_LOW (ops[1]), > + TREE_INT_CST_HIGH (ops[1])); > + else > + { > + if (vect_print_dump_info (REPORT_DETAILS)) > + fprintf (vect_dump, "invalid types in dot-prod"); > + > + return false; > + } > + } Please instead simply do if (code == DOT_PROD_EXPR && !types_compatible_p (TREE_TYPE (ops[0]), TREE_TYPE (ops[1]))) { if (TREE_CODE (ops[0]) == INTEGER_CST) ops[0] = fold_convert (TREE_TYPE (ops[1]), ops[0]); else if (TREE_CODE (ops[1]) == INTEEGER_CST) ops[1] = fold_convert (TREE_TYPE (ops[0]), ops[1]); > + else > + { > + if (vect_print_dump_info (REPORT_DETAILS)) > + fprintf (vect_dump, "invalid types in dot-prod"); > + > + return false; } } Thanks. > + > if (!vec_stmt) /* transformation not required. */ > { > if (!vect_model_reduction_cost (stmt_info, epilog_reduc_code, ncopies))
OK. Thanks, Ira
Author: irar Date: Tue Jun 21 11:58:33 2011 New Revision: 175255 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=175255 Log: PR tree-optimization/49478 * tree-vect-loop.c (vectorizable_reduction): Handle DOT_PROD_EXPR with constant operand. Added: trunk/gcc/testsuite/gcc.dg/vect/pr49478.c Modified: trunk/gcc/ChangeLog trunk/gcc/testsuite/ChangeLog trunk/gcc/tree-vect-loop.c
Fixed.