Let tree_single_nonzero_warnv_p use range information

2017-04-25  Marc Glisse  <marc.glisse@inria.fr>

gcc/
	* fold-const.c (tree_single_nonzero_warnv_p): Handle SSA_NAME.

gcc/testsuite/
	* gcc.dg/tree-ssa/cmpmul-1.c: New file.
	* gcc.dg/Wstrict-overflow-18.c: Xfail.

From-SVN: r247123
This commit is contained in:
Marc Glisse 2017-04-25 08:51:44 +02:00 committed by Marc Glisse
parent 452e929aae
commit bb0249cbb7
5 changed files with 27 additions and 1 deletions

View File

@ -1,3 +1,7 @@
2017-04-25 Marc Glisse <marc.glisse@inria.fr>
* fold-const.c (tree_single_nonzero_warnv_p): Handle SSA_NAME.
2017-04-25 Julian Brown <julian@codesourcery.com>
Naveen H.S <Naveen.Hurugalawadi@cavium.com>

View File

@ -13412,6 +13412,11 @@ tree_single_nonzero_warnv_p (tree t, bool *strict_overflow_p)
}
break;
case SSA_NAME:
if (!INTEGRAL_TYPE_P (TREE_TYPE (t)))
break;
return expr_not_equal_to (t, wi::zero (TYPE_PRECISION (TREE_TYPE (t))));
default:
break;
}

View File

@ -1,3 +1,8 @@
2017-04-25 Marc Glisse <marc.glisse@inria.fr>
* gcc.dg/tree-ssa/cmpmul-1.c: New file.
* gcc.dg/Wstrict-overflow-18.c: Xfail.
2017-04-22 Janus Weil <janus@gcc.gnu.org>
PR fortran/80121

View File

@ -14,7 +14,8 @@ foo (struct c *p)
for (i = 0; i < p->a - p->b; ++i)
{
if (i > 0) /* { dg-warning "signed overflow" "" } */
/* See PR80511 for the XFAIL. */
if (i > 0) /* { dg-warning "signed overflow" "" { xfail *-*-* } } */
sum += 2;
bar (p);
}

View File

@ -0,0 +1,11 @@
/* { dg-do compile } */
/* { dg-options "-O2 -fdump-tree-optimized-raw" } */
int f(int a, int b, int c){
c |= 1; // c cannot be 0
a *= c;
b *= c;
return a == b;
}
/* { dg-final { scan-tree-dump-not "bit_ior_expr" "optimized" } } */