* [Bug middle-end/49478] ice in expand_widen_pattern_expr with -O3
2011-06-20 19:47 [Bug c/49478] New: ice in expand_widen_pattern_expr with -O3 dcb314 at hotmail dot com
@ 2011-06-21 0:32 ` hjl.tools at gmail dot com
2011-06-21 7:33 ` irar at il dot ibm.com
` (4 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: hjl.tools at gmail dot com @ 2011-06-21 0:32 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49478
H.J. Lu <hjl.tools at gmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2011.06.21 00:31:48
CC| |irar at gcc dot gnu.org
Target Milestone|--- |4.7.0
Ever Confirmed|0 |1
--- Comment #1 from H.J. Lu <hjl.tools at gmail dot com> 2011-06-21 00:31:48 UTC ---
It is caused by revision 174735:
http://gcc.gnu.org/ml/gcc-cvs/2011-06/msg00223.html
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug middle-end/49478] ice in expand_widen_pattern_expr with -O3
2011-06-20 19:47 [Bug c/49478] New: ice in expand_widen_pattern_expr with -O3 dcb314 at hotmail dot com
2011-06-21 0:32 ` [Bug middle-end/49478] " hjl.tools at gmail dot com
@ 2011-06-21 7:33 ` irar at il dot ibm.com
2011-06-21 9:40 ` rguenth at gcc dot gnu.org
` (3 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: irar at il dot ibm.com @ 2011-06-21 7:33 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49478
Ira Rosen <irar at il dot ibm.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |irar at il dot ibm.com
--- Comment #2 from Ira Rosen <irar at il dot ibm.com> 2011-06-21 07:33:15 UTC ---
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))
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug middle-end/49478] ice in expand_widen_pattern_expr with -O3
2011-06-20 19:47 [Bug c/49478] New: ice in expand_widen_pattern_expr with -O3 dcb314 at hotmail dot com
2011-06-21 0:32 ` [Bug middle-end/49478] " hjl.tools at gmail dot com
2011-06-21 7:33 ` irar at il dot ibm.com
@ 2011-06-21 9:40 ` rguenth at gcc dot gnu.org
2011-06-21 10:03 ` irar at il dot ibm.com
` (2 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: rguenth at gcc dot gnu.org @ 2011-06-21 9:40 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49478
--- Comment #3 from Richard Guenther <rguenth at gcc dot gnu.org> 2011-06-21 09:39:47 UTC ---
(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))
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug middle-end/49478] ice in expand_widen_pattern_expr with -O3
2011-06-20 19:47 [Bug c/49478] New: ice in expand_widen_pattern_expr with -O3 dcb314 at hotmail dot com
` (2 preceding siblings ...)
2011-06-21 9:40 ` rguenth at gcc dot gnu.org
@ 2011-06-21 10:03 ` irar at il dot ibm.com
2011-06-21 11:59 ` [Bug tree-optimization/49478] " irar at gcc dot gnu.org
2011-06-21 12:14 ` irar at il dot ibm.com
5 siblings, 0 replies; 7+ messages in thread
From: irar at il dot ibm.com @ 2011-06-21 10:03 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49478
--- Comment #4 from Ira Rosen <irar at il dot ibm.com> 2011-06-21 10:03:05 UTC ---
OK.
Thanks,
Ira
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug tree-optimization/49478] ice in expand_widen_pattern_expr with -O3
2011-06-20 19:47 [Bug c/49478] New: ice in expand_widen_pattern_expr with -O3 dcb314 at hotmail dot com
` (3 preceding siblings ...)
2011-06-21 10:03 ` irar at il dot ibm.com
@ 2011-06-21 11:59 ` irar at gcc dot gnu.org
2011-06-21 12:14 ` irar at il dot ibm.com
5 siblings, 0 replies; 7+ messages in thread
From: irar at gcc dot gnu.org @ 2011-06-21 11:59 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49478
--- Comment #5 from irar at gcc dot gnu.org 2011-06-21 11:58:36 UTC ---
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
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug tree-optimization/49478] ice in expand_widen_pattern_expr with -O3
2011-06-20 19:47 [Bug c/49478] New: ice in expand_widen_pattern_expr with -O3 dcb314 at hotmail dot com
` (4 preceding siblings ...)
2011-06-21 11:59 ` [Bug tree-optimization/49478] " irar at gcc dot gnu.org
@ 2011-06-21 12:14 ` irar at il dot ibm.com
5 siblings, 0 replies; 7+ messages in thread
From: irar at il dot ibm.com @ 2011-06-21 12:14 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49478
Ira Rosen <irar at il dot ibm.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |FIXED
--- Comment #6 from Ira Rosen <irar at il dot ibm.com> 2011-06-21 12:14:09 UTC ---
Fixed.
^ permalink raw reply [flat|nested] 7+ messages in thread