diff options
author | Andrew Haley <aph@redhat.com> | 2017-03-08 11:35:23 +0000 |
---|---|---|
committer | Andrew Haley <aph@gcc.gnu.org> | 2017-03-08 11:35:23 +0000 |
commit | f1a675e486155ebeb0abc90b73aa75d7079d9b58 (patch) | |
tree | 8193f00a0d438ba2efedc392641923b049315a04 /gcc | |
parent | 2ff555ff0e711a1f75b4b7054b50650a6d6770b4 (diff) | |
download | gcc-f1a675e486155ebeb0abc90b73aa75d7079d9b58.zip gcc-f1a675e486155ebeb0abc90b73aa75d7079d9b58.tar.gz gcc-f1a675e486155ebeb0abc90b73aa75d7079d9b58.tar.bz2 |
re PR tree-optimization/79943 (Loop splitting breaks with loops of pointer type)
2017-03-08 Andrew Haley <aph@redhat.com>
PR tree-optimization/79943
* tree-ssa-loop-split.c (compute_new_first_bound): When
calculating the new upper bound, (END-BEG) should be added, not
subtracted.
From-SVN: r245974
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/tree-ssa/pr79943.c | 40 | ||||
-rw-r--r-- | gcc/tree-ssa-loop-split.c | 1 |
4 files changed, 52 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 212ebc6..56b2281 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2017-03-08 Andrew Haley <aph@redhat.com> + + PR tree-optimization/79943 + * tree-ssa-loop-split.c (compute_new_first_bound): When + calculating the new upper bound, (END-BEG) should be added, not + subtracted. + 2017-03-08 Jakub Jelinek <jakub@redhat.com> * config/avr/avr.md (setmemhi): Make sure match_dup diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index eef8826..7a539e6 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2017-03-08 Andrew Haley <aph@redhat.com> + + PR tree-optimization/79943 + * gcc.dg/tree-ssa/pr79943.c: New test. + 2017-03-08 Richard Biener <rguenther@suse.de> PR tree-optimization/79920 diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr79943.c b/gcc/testsuite/gcc.dg/tree-ssa/pr79943.c new file mode 100644 index 0000000..d841d60 --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/pr79943.c @@ -0,0 +1,40 @@ +/* { dg-do run } */ +/* { dg-options "-O2 -fsplit-loops -fdump-tree-lsplit-details" } */ +/* { dg-require-effective-target int32plus } */ + +#ifdef __cplusplus +extern "C" void abort (void); +#else +extern void abort (void); +#endif + +typedef struct { + int n; +} region_t; + +void set (region_t *region) __attribute__((noinline)); +void doit (region_t *beg, region_t *end, region_t *limit) + __attribute__((noinline)); + +region_t regions[10]; + +void +set (region_t *region) { + region->n = 1; +} + +void +doit (region_t *beg, region_t *end, region_t *limit) { + for (region_t *cur = beg; cur < end; cur++) { + if (cur < limit) { + set(cur); + } + } +} + +int +main (void) { + doit(®ions[0], ®ions[2], ®ions[10]); + if (regions[1].n != 1) + abort(); +} diff --git a/gcc/tree-ssa-loop-split.c b/gcc/tree-ssa-loop-split.c index 39bffc4..fd97213 100644 --- a/gcc/tree-ssa-loop-split.c +++ b/gcc/tree-ssa-loop-split.c @@ -436,7 +436,6 @@ compute_new_first_bound (gimple_seq *stmts, struct tree_niter_desc *niter, if (POINTER_TYPE_P (TREE_TYPE (guard_init))) { enddiff = gimple_convert (stmts, sizetype, enddiff); - enddiff = gimple_build (stmts, NEGATE_EXPR, sizetype, enddiff); newbound = gimple_build (stmts, POINTER_PLUS_EXPR, TREE_TYPE (guard_init), guard_init, enddiff); |