Skip to content

Commit 00b82d4

Browse files
committed
added a test
1 parent 763b42f commit 00b82d4

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

test/compiler/ssair.jl

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,3 +96,19 @@ let
9696
Meta.isexpr(ex, :meta)
9797
end
9898
end
99+
100+
# PR #32145
101+
# Make sure IncrementalCompact can handle blocks with predecessors of index 0
102+
# while removing blocks with no predecessors.
103+
let cfg = CFG(BasicBlock[
104+
make_bb([] , [2, 4]),
105+
make_bb([1] , [4, 5]),
106+
make_bb([] , [4] ), # should be removed
107+
make_bb([0, 1, 2] , [5] ), # 0 predecessor should be preserved
108+
make_bb([2, 3] , [] ),
109+
], Int[])
110+
code = Compiler.IRCode(
111+
[], [], Int32[], UInt8[], cfg, LineInfoNode[], [], [], [])
112+
compact = Compiler.IncrementalCompact(code, true)
113+
@test length(compact.result_bbs) == 4 && 0 in compact.result_bbs[3].preds
114+
end

0 commit comments

Comments
 (0)