From 28333b07f2f51c8a4410d6a31cedf960899a0ad4 Mon Sep 17 00:00:00 2001 From: rguenth Date: Fri, 22 Nov 2013 13:17:41 +0000 Subject: [PATCH] 2013-11-22 Richard Biener Revert 2013-11-21 Richard Biener * tree-ssa-loop-ch.c (copy_loop_headers): Decrement nb_iterations_upper_bound by one. * gcc.dg/torture/20131122-0.c: New testcase. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@205256 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 8 ++++++++ gcc/testsuite/ChangeLog | 4 ++++ gcc/testsuite/gcc.dg/torture/20131122-0.c | 34 +++++++++++++++++++++++++++++++ gcc/tree-ssa-loop-ch.c | 10 --------- 4 files changed, 46 insertions(+), 10 deletions(-) create mode 100644 gcc/testsuite/gcc.dg/torture/20131122-0.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 9afe2645d3c..d04b496e235 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,11 @@ +2013-11-22 Richard Biener + + Revert + 2013-11-21 Richard Biener + + * tree-ssa-loop-ch.c (copy_loop_headers): Decrement + nb_iterations_upper_bound by one. + 2013-11-22 H.J. Lu * config/i386/i386.c (processor_alias_table): Enable PTA_POPCNT diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 220a5eca77f..3095cffa11d 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2013-11-22 Richard Biener + + * gcc.dg/torture/20131122-0.c: New testcase. + 2013-11-22 Jakub Jelinek * gcc.dg/vect/vect-124.c: New test. diff --git a/gcc/testsuite/gcc.dg/torture/20131122-0.c b/gcc/testsuite/gcc.dg/torture/20131122-0.c new file mode 100644 index 00000000000..42d92faed94 --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/20131122-0.c @@ -0,0 +1,34 @@ +/* { dg-do run } */ + +extern int memcmp (const void *, const void *, __SIZE_TYPE__); +extern void abort (void); + +void __attribute__ ((noinline)) +f (long *s, long *t, int len1, int len2) +{ + int i, j; + + j = 2; + for (i = len1 - 1; i >= 0; i--) + { + s[j--] = (i < len2 ? t[i] : t[len2 - 1] < 0 ? -1 : 0); + if (j < 0) + break; + } +} + +long s[3]; +long t[3]; + +int +main (void) +{ + t[0] = 1; + t[1] = 2; + t[2] = 3; + f (s, t, 3, 3); + if (memcmp (s, t, sizeof (s)) != 0) + abort (); + return 0; +} + diff --git a/gcc/tree-ssa-loop-ch.c b/gcc/tree-ssa-loop-ch.c index ccaa9c8987e..df45c286790 100644 --- a/gcc/tree-ssa-loop-ch.c +++ b/gcc/tree-ssa-loop-ch.c @@ -243,16 +243,6 @@ copy_loop_headers (void) are not now, since there was the loop exit condition. */ split_edge (loop_preheader_edge (loop)); split_edge (loop_latch_edge (loop)); - - /* We peeled off one iteration of the loop thus we can lower - the maximum number of iterations if we have a previously - recorded value for that. */ - double_int max; - if (get_max_loop_iterations (loop, &max)) - { - max -= double_int_one; - loop->nb_iterations_upper_bound = max; - } } update_ssa (TODO_update_ssa); -- 2.11.4.GIT