aboutsummaryrefslogtreecommitdiff
path: root/gcc/graphite-scop-detection.c
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2017-02-08 08:30:48 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2017-02-08 08:30:48 +0000
commitd798497efc24b3787683cd31ead1863fa7a461f5 (patch)
treee67e19eeba496fbeca4050cfa440bcc25e72fd05 /gcc/graphite-scop-detection.c
parent41cf3f3eb91e46b1465715053791612a1a1d482d (diff)
downloadgcc-d798497efc24b3787683cd31ead1863fa7a461f5.zip
gcc-d798497efc24b3787683cd31ead1863fa7a461f5.tar.gz
gcc-d798497efc24b3787683cd31ead1863fa7a461f5.tar.bz2
re PR tree-optimization/71824 (ICE when compiling libiberty with Graphite loop optimizations)
2017-02-08 Richard Biener <rguenther@suse.de> PR tree-optimization/71824 * graphite-scop-detection.c (scop_detection::build_scop_breadth): Check all loops contained in the merged region. * gcc.dg/graphite/pr71824-2.c: New testcase. From-SVN: r245270
Diffstat (limited to 'gcc/graphite-scop-detection.c')
-rw-r--r--gcc/graphite-scop-detection.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/gcc/graphite-scop-detection.c b/gcc/graphite-scop-detection.c
index 2f96412..ee1f705 100644
--- a/gcc/graphite-scop-detection.c
+++ b/gcc/graphite-scop-detection.c
@@ -905,9 +905,19 @@ scop_detection::build_scop_breadth (sese_l s1, loop_p loop)
sese_l combined = merge_sese (s1, s2);
- if (combined
- && loop_is_valid_in_scop (loop, combined)
- && loop_is_valid_in_scop (loop->next, combined))
+ /* Combining adjacent loops may add unrelated loops into the
+ region so we have to check all sub-loops of the outer loop
+ that are in the combined region. */
+ if (combined)
+ for (l = loop_outer (loop)->inner; l; l = l->next)
+ if (bb_in_sese_p (l->header, combined)
+ && ! loop_is_valid_in_scop (l, combined))
+ {
+ combined = invalid_sese;
+ break;
+ }
+
+ if (combined)
s1 = combined;
else
add_scop (s2);