diff options
| author | jakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4> | 2013-01-03 09:05:43 +0000 |
|---|---|---|
| committer | jakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4> | 2013-01-03 09:05:43 +0000 |
| commit | e4bef2715caaca8c1918f900bd95aff5b0d74c9a (patch) | |
| tree | bf717bd5e0292f0afa63db0a241a01e20f3d4a9e | |
| parent | d871c5dca71fedee4b728ebe624b165205bca076 (diff) | |
| download | ppe42-gcc-e4bef2715caaca8c1918f900bd95aff5b0d74c9a.tar.gz ppe42-gcc-e4bef2715caaca8c1918f900bd95aff5b0d74c9a.zip | |
PR rtl-optimization/55838
* loop-iv.c (iv_number_of_iterations): Call lowpart_subreg on
iv0.step, iv1.step and step.
* gcc.dg/pr55838.c: New test.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@194837 138bc75d-0d04-0410-961f-82ee72b054a4
| -rw-r--r-- | gcc/ChangeLog | 6 | ||||
| -rw-r--r-- | gcc/loop-iv.c | 6 | ||||
| -rw-r--r-- | gcc/testsuite/ChangeLog | 3 | ||||
| -rw-r--r-- | gcc/testsuite/gcc.dg/pr55838.c | 13 |
4 files changed, 27 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 346b366f04d..bdb4d26f94b 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,4 +1,10 @@ 2013-01-03 Jakub Jelinek <jakub@redhat.com> + + PR rtl-optimization/55838 + * loop-iv.c (iv_number_of_iterations): Call lowpart_subreg on + iv0.step, iv1.step and step. + +2013-01-03 Jakub Jelinek <jakub@redhat.com> Marc Glisse <marc.glisse@inria.fr> PR tree-optimization/55832 diff --git a/gcc/loop-iv.c b/gcc/loop-iv.c index 50b75362a97..d089fbf7cea 100644 --- a/gcc/loop-iv.c +++ b/gcc/loop-iv.c @@ -1,5 +1,5 @@ /* Rtl-level induction variable analysis. - Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 + Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012, 2013 Free Software Foundation, Inc. This file is part of GCC. @@ -2406,6 +2406,9 @@ iv_number_of_iterations (struct loop *loop, rtx insn, rtx condition, iv1.step = const0_rtx; } + iv0.step = lowpart_subreg (mode, iv0.step, comp_mode); + iv1.step = lowpart_subreg (mode, iv1.step, comp_mode); + /* This is either infinite loop or the one that ends immediately, depending on initial values. Unswitching should remove this kind of conditions. */ if (iv0.step == const0_rtx && iv1.step == const0_rtx) @@ -2516,6 +2519,7 @@ iv_number_of_iterations (struct loop *loop, rtx insn, rtx condition, step = simplify_gen_unary (NEG, comp_mode, iv1.step, comp_mode); else step = iv0.step; + step = lowpart_subreg (mode, step, comp_mode); delta = simplify_gen_binary (MINUS, comp_mode, iv1.base, iv0.base); delta = lowpart_subreg (mode, delta, comp_mode); delta = simplify_gen_binary (UMOD, mode, delta, step); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 12f1688c447..37244533de0 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,8 @@ 2013-01-03 Jakub Jelinek <jakub@redhat.com> + PR rtl-optimization/55838 + * gcc.dg/pr55838.c: New test. + PR tree-optimization/55832 * gcc.c-torture/compile/pr55832.c: New test. diff --git a/gcc/testsuite/gcc.dg/pr55838.c b/gcc/testsuite/gcc.dg/pr55838.c new file mode 100644 index 00000000000..d2d6e142ba2 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr55838.c @@ -0,0 +1,13 @@ +/* PR rtl-optimization/55838 */ +/* { dg-do compile } */ +/* { dg-options "-O2 -funroll-loops" } */ + +int a; +unsigned char c; + +void +f (void) +{ + while (c++ < 2) + c = a += 129; +} |

