From 385f726094f049f3fa1d8e88f24a3152ad9b5239 Mon Sep 17 00:00:00 2001 From: Chris Fallin Date: Sat, 20 Nov 2021 12:46:10 -0800 Subject: [PATCH] fix stackifier: forward edge out of loop header to loop tail --- src/backend.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/backend.rs b/src/backend.rs index 34569e6..398f7b2 100644 --- a/src/backend.rs +++ b/src/backend.rs @@ -25,7 +25,6 @@ enum Region { /// end (after terminator) of second block. Can be extended past /// the end if needed. Backward(OrderedBlockId, OrderedBlockId), - // TODO: support irreducible CFGs by adding a `BackwardDispatch` // region kind whose start is adjusted back to the first loop // block. BackwardDispatch is contagious, i.e. converts adjacent @@ -157,7 +156,7 @@ impl Shape { regions[i] = Region::Backward(a, b); true } - (Region::Forward(_a, b), Region::Backward(c, d)) if b > c && b <= d => { + (Region::Forward(a, b), Region::Backward(c, d)) if b > c && b <= d && a < c => { panic!("Irreducible CFG"); } (Region::Forward(a, b), Region::Forward(c, d)) if b == d => {