Commit 6f1c9cd0 by Sebastian Pop Committed by Sebastian Pop

re PR tree-optimization/19590 (IVs with the same evolution not eliminated)

	PR tree-optimization/19590
	* tree-vrp.c (adjust_range_with_scev): Set the range when the result
	of scev is a constant.
	* gcc/testsuite/gcc.dg/tree-ssa/pr19590.c: New.

From-SVN: r125925
parent e44e043c
2007-06-21 Sebastian Pop <sebpop@gmail.com>
PR tree-optimization/19590
* tree-vrp.c (adjust_range_with_scev): Set the range when the result
of scev is a constant.
* gcc/testsuite/gcc.dg/tree-ssa/pr19590.c: New.
2007-06-21 Kenneth Zadeck <zadeck@naturalbridge.com>
* df-problems.c (df_note_bb_compute): Made computation of live
......
/* { dg-do compile } */
/* { dg-options "-O2 -fdump-tree-ivopts" } */
void vnum_test8(int *data)
{
int i;
int stop = data[3];
int m = data[4];
int n = m;
for (i=1; i<stop; i++) {
int k = data[2];
data[k] = 2;
data[0] = m - n;
k = data[1];
m = m + k;
n = n + k;
}
}
/* Using the SCEV analysis, this loop should be transformed to:
| void vnum_result8(int *data)
|{
| int i;
| int stop = data[3];
| for (i=1; i<stop; i++) {
| int k = data[2];
| data[k] = 2;
| data[0] = 0;
| }
|}
*/
/* { dg-final { scan-tree-dump-times "= 0;" 1 "ivopts"} } */
/* { dg-final { scan-tree-dump-times "= 2;" 1 "ivopts"} } */
/* { dg-final { cleanup-tree-dump "ivopts" } } */
......@@ -2638,6 +2638,14 @@ adjust_range_with_scev (value_range_t *vr, struct loop *loop, tree stmt,
return;
chrec = instantiate_parameters (loop, analyze_scalar_evolution (loop, var));
/* Like in PR19590, scev can return a constant function. */
if (is_gimple_min_invariant (chrec))
{
set_value_range (vr, VR_RANGE, chrec, chrec, vr->equiv);
return;
}
if (TREE_CODE (chrec) != POLYNOMIAL_CHREC)
return;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment