https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83385
--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> --- Nothing obvious (well, the .optimized result is obviously broken). ISL transforms [scheduler] original ast: { for (int c0 = 0; c0 <= 1; c0 += 1) { S_9(c0); for (int c1 = 0; c1 <= 1; c1 += 1) { S_3(c0, c1); S_5(c0, c1); for (int c2 = 0; c2 <= 1; c2 += 1) S_6(c0, c1, c2); S_20(c0, c1); } S_8(c0); S_21(c0); } S_10(); for (int c1 = 0; c1 <= 1; c1 += 1) S_4(0, c1); } [scheduler] AST generated by isl: { S_9(0); S_3(0, 0); S_5(0, 0); S_20(0, 0); for (int c0 = 1; c0 <= 2; c0 += 1) { if (c0 == 2) S_9(1); S_3(c0 - 1, -c0 + 2); S_5(c0 - 1, -c0 + 2); S_20(c0 - 1, -c0 + 2); if (c0 == 1) { S_8(0); S_21(0); } } S_3(1, 1); S_5(1, 1); S_20(1, 1); S_8(1); S_21(1); for (int c0 = 0; c0 <= 1; c0 += 1) S_4(0, c0); S_10(); for (int c0 = 0; c0 <= 1; c0 += 1) for (int c1 = 0; c1 <= 3; c1 += 1) S_6(c1 / 2, c1 % 2, c0); } what is odd is the last loop in the original AST - that belongs to the if (aj != 0) --n1; stmt and hints at a bogus initial schedule generation (eventually again confusing the order we visit BBs in...). Indeed - scop->pbbs has that block ordered last :/ testing fix.