Generate correctly typed compare in canonicalize_loop_ivs

2018-06-20  Tom de Vries  <tdevries@suse.de>

	PR tree-optimization/86097
	* tree-ssa-loop-manip.c (canonicalize_loop_ivs): Also convert *nit to
	iv type if signedness of iv type is not the same as that of *nit.

	* gcc.dg/autopar/pr86097.c: New test.

From-SVN: r261804
This commit is contained in:
Tom de Vries 2018-06-20 14:44:45 +00:00 committed by Tom de Vries
parent d53e8ef490
commit 60f02f9021
4 changed files with 44 additions and 1 deletions

View File

@ -1,3 +1,9 @@
2018-06-20 Tom de Vries <tdevries@suse.de>
PR tree-optimization/86097
* tree-ssa-loop-manip.c (canonicalize_loop_ivs): Also convert *nit to
iv type if signedness of iv type is not the same as that of *nit.
2018-06-20 Jakub Jelinek <jakub@redhat.com>
* cfgrtl.c (rtl_verify_edges): Formatting fix. If bb->preds has any

View File

@ -1,3 +1,8 @@
2018-06-20 Tom de Vries <tdevries@suse.de>
PR tree-optimization/86097
* gcc.dg/autopar/pr86097.c: New test.
2018-06-20 Nathan Sidwell <nathan@acm.org>
PR c++/85634

View File

@ -0,0 +1,31 @@
/* { dg-options "-O2 -ftree-parallelize-loops=2 -fno-tree-dce -Wno-aggressive-loop-optimizations" } */
int rp, vd;
void
p5 (int cd)
{
while (cd != 0)
{
for (rp = 0; rp < 4; ++rp)
for (vd = 0; vd < 1; ++vd)
{
g0:
;
}
++rp;
}
while (rp < 2)
{
for (cd = 0; cd < 1; ++cd)
for (rp = 1; rp != 0; ++rp)
{
}
++rp;
}
if (cd != 0)
goto g0;
}

View File

@ -1542,7 +1542,8 @@ canonicalize_loop_ivs (struct loop *loop, tree *nit, bool bump_in_latch)
precision = GET_MODE_PRECISION (mode);
type = build_nonstandard_integer_type (precision, unsigned_p);
if (original_precision != precision)
if (original_precision != precision
|| TYPE_UNSIGNED (TREE_TYPE (*nit)) != unsigned_p)
{
*nit = fold_convert (type, *nit);
*nit = force_gimple_operand (*nit, &stmts, true, NULL_TREE);