Do not call range_of_ssa_name_with_loop_info with the loop tree root.

gcc/ChangeLog:

	PR tree-optimization/97396
	* gimple-range.cc (gimple_ranger::range_of_phi): Do not call
	range_of_ssa_name_with_loop_info with the loop tree root.

gcc/testsuite/ChangeLog:

	* gcc.dg/pr97396.c: New test.
This commit is contained in:
Aldy Hernandez 2020-10-13 03:05:23 -04:00
parent ea9535e75e
commit a121715bca
2 changed files with 24 additions and 1 deletions

View File

@ -490,7 +490,7 @@ gimple_ranger::range_of_phi (irange &r, gphi *phi)
{
value_range loop_range;
class loop *l = loop_containing_stmt (phi);
if (l)
if (l && loop_outer (l))
{
range_of_ssa_name_with_loop_info (loop_range, phi_def, l, phi);
if (!loop_range.varying_p ())

View File

@ -0,0 +1,23 @@
// { dg-do compile }
// { dg-options "-O1 -ftree-vrp" }
// { dg-additional-options "-m32" { target { i?86-*-* x86_64-*-* } } }
unsigned int
po (char *os, unsigned int al)
{
for (;;)
{
int qx = 0;
while (al < 1)
{
char *cw;
cw = os + qx;
if (cw)
return al + qx;
qx += sizeof *cw;
}
}
}