Bootstrapped and tested on x86_64-unknown-linux-gnu, applied. Richard.
2018-01-08 Richard Biener <rguent...@suse.de> PR tree-optimization/83563 * graphite.c (canonicalize_loop_closed_ssa_form): Reset the SCEV cache. * gcc.dg/graphite/pr83563.c: New testcase. Index: gcc/graphite.c =================================================================== --- gcc/graphite.c (revision 256329) +++ gcc/graphite.c (working copy) @@ -322,6 +323,10 @@ canonicalize_loop_closed_ssa_form (void) FOR_EACH_LOOP (loop, LI_FROM_INNERMOST) canonicalize_loop_closed_ssa (loop); + /* We can end up releasing duplicate exit PHIs and also introduce + additional copies so the cached information isn't correct anymore. */ + scev_reset (); + checking_verify_loop_closed_ssa (true); } Index: gcc/testsuite/gcc.dg/graphite/pr83563.c =================================================================== --- gcc/testsuite/gcc.dg/graphite/pr83563.c (nonexistent) +++ gcc/testsuite/gcc.dg/graphite/pr83563.c (working copy) @@ -0,0 +1,15 @@ +/* { dg-do compile } */ +/* { dg-options "-O -fgraphite -ftree-loop-distribution -fno-tree-dominator-opts -fno-tree-sink -fno-tree-dce" } */ + +void +sy (void) +{ + int hb; + + for (hb = 1; hb != 0; hb += hb) + { + } + + while (hb < 1) + ++hb; +}