From 7e2ac86c349ecfe90cc98f24230659136806fefa Mon Sep 17 00:00:00 2001 From: Zdenek Dvorak Date: Wed, 10 Jan 2007 01:44:26 +0100 Subject: re PR middle-end/30322 (((-i-1) + i) +1) is turned into ~i + (i+1) and never into 0 on the tree level) PR tree-optimization/30322 * tree-ssa-loop-ivopts.c (fold_affine_expr, iv_value): Removed. (cand_value_at): Return the value as aff_tree. (may_eliminate_iv): Convert the bound from aff_tree to tree. * tree-affine.c (aff_combination_add_cst, aff_combination_add_product, aff_combination_mult): New functions. (aff_combination_add): Use aff_combination_add_cst. (aff_combination_convert): Allow conversions to a wider type. (tree_to_aff_combination): Handle BIT_NOT_EXPR. * tree-affine.h (aff_combination_mult): Declare. * gcc.dg/tree-ssa/loop-21.c: New test. From-SVN: r120630 --- gcc/testsuite/gcc.dg/tree-ssa/loop-21.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 gcc/testsuite/gcc.dg/tree-ssa/loop-21.c (limited to 'gcc/testsuite/gcc.dg') diff --git a/gcc/testsuite/gcc.dg/tree-ssa/loop-21.c b/gcc/testsuite/gcc.dg/tree-ssa/loop-21.c new file mode 100644 index 0000000..59a17cb --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/loop-21.c @@ -0,0 +1,17 @@ +/* PR tree-optimization/30322 */ + +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-final_cleanup" } */ + +extern void op( int, int); +void foo(int f0, int f1, int e0, int e1) +{ + int i0, i1; + + for (i1 = f1; i1 <= e1; ++i1) + for (i0 = f0; i0 <= e0; ++i0) + op(i0, i1); +} + +/* { dg-final { scan-tree-dump-times "~" 0 "final_cleanup" } } */ +/* { dg-final { cleanup-tree-dump "final_cleanup" } } */ -- cgit v1.1