Commit 5de2df7b by Kazu Hirata Committed by Kazu Hirata

re PR tree-optimization/21563 (A trivial VRP opportunity missed)

gcc/
	PR tree-optimization/21563
	* tree-vrp.c (compare_value): Return boolean_false_node when
	SSA_NAME in "if (SSA_NAME == CST)" is strictly smaller than or
	strictly larger than CST.

testsuite/
	PR tree-optimization/21563
	* gcc.dg/tree-ssa/pr21563.c: New.

From-SVN: r99705
parent 92df92cd
...@@ -3,6 +3,11 @@ ...@@ -3,6 +3,11 @@
* tree-optimize.c (init_tree_optimization_passes): Move * tree-optimize.c (init_tree_optimization_passes): Move
pass_cd_dce in place of the last pass_dce. pass_cd_dce in place of the last pass_dce.
PR tree-optimization/21563
* tree-vrp.c (compare_value): Return boolean_false_node when
SSA_NAME in "if (SSA_NAME == CST)" is strictly smaller than or
strictly larger than CST.
2005-05-14 Nathan Sidwell <nathan@codesourcery.com> 2005-05-14 Nathan Sidwell <nathan@codesourcery.com>
Jan-Benedict Glaw <jbglaw@lug-owl.de> Jan-Benedict Glaw <jbglaw@lug-owl.de>
......
2005-05-14 Kazu Hirata <kazu@cs.umass.edu>
PR tree-optimization/21563
* gcc.dg/tree-ssa/pr21563.c: New.
2005-05-14 Jan Hubicka <jh@suse.cz> 2005-05-14 Jan Hubicka <jh@suse.cz>
* gcc.dg/noreturn-7.c: Allow control reaches warning. * gcc.dg/noreturn-7.c: Allow control reaches warning.
......
/* PR tree-optimization/21563
Make sure VRP folds the second "if" statement. */
/* { dg-do compile } */
/* { dg-options "-O2 -fno-tree-dominator-opts -fdump-tree-vrp-details" } */
int
foo (int a)
{
if (a > 1)
if (a == 0)
return 1;
return 0;
}
/* { dg-final { scan-tree-dump-times "Folding predicate" 1 "vrp"} } */
/* { dg-final { cleanup-tree-dump "vrp" } } */
...@@ -1204,6 +1204,9 @@ compare_range_with_value (enum tree_code comp, value_range *vr, tree val) ...@@ -1204,6 +1204,9 @@ compare_range_with_value (enum tree_code comp, value_range *vr, tree val)
else if (cmp == -1 || cmp == 1 || cmp == 2) else if (cmp == -1 || cmp == 1 || cmp == 2)
return boolean_false_node; return boolean_false_node;
} }
else if (compare_values (val, vr->min) == -1
|| compare_values (vr->max, val) == -1)
return boolean_false_node;
return NULL_TREE; return NULL_TREE;
} }
......
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