re PR tree-optimization/22348 (Execution continues past end of for loop end condition with optimisation enabled)

PR tree-optimize/22348
	* tree-ssa-loop-niter.c (number_of_iterations_cond):
	Fold the partial computation.

	* gcc.c-torture/execute/pr22348.c: New.

From-SVN: r102427
This commit is contained in:
Zdenek Dvorak 2005-07-27 16:04:17 +02:00 committed by Zdenek Dvorak
parent 3ac01fdeef
commit 26c406400e
4 changed files with 27 additions and 1 deletions

View File

@ -1,3 +1,9 @@
2005-07-27 Zdenek Dvorak <dvorakz@suse.cz>
PR tree-optimize/22348
* tree-ssa-loop-niter.c (number_of_iterations_cond):
Fold the partial computation.
2005-07-27 Zdenek Dvorak <dvorakz@suse.cz>
PR tree-optimization/22325

View File

@ -1,3 +1,8 @@
2005-07-27 Zdenek Dvorak <dvorakz@suse.cz>
PR tree-optimize/22348
* gcc.c-torture/execute/pr22348.c: New.
2005-07-27 Richard Guenther <rguenther@suse.de>
* gcc.dg/tree-ssa/salias-1.c: New testcase.

View File

@ -0,0 +1,15 @@
void abort (void);
void f(int i)
{
if (i>4 + 3 * 16)
abort();
}
int main()
{
unsigned int buflen, i;
buflen = 4 + 3 * 16;
for (i = 4; i < buflen; i+= 3)
f(i);
return 0;
}

View File

@ -275,7 +275,7 @@ number_of_iterations_cond (tree type, tree base0, tree step0,
step = fold_unary_to_constant (NEGATE_EXPR, type, step1);
else
step = step0;
delta = build2 (MINUS_EXPR, type, base1, base0);
delta = fold_build2 (MINUS_EXPR, type, base1, base0);
delta = fold_build2 (FLOOR_MOD_EXPR, type, delta, step);
may_xform = boolean_false_node;