From 6ca63d4c68c17497422348f86bc1e55a99eb51fc Mon Sep 17 00:00:00 2001 From: visualfc Date: Fri, 2 Aug 2024 11:54:43 +0800 Subject: [PATCH] ssa: fix defer move block[0] index --- cl/_testrt/nextblock/in.go | 10 ++++++++++ cl/_testrt/nextblock/out.ll | 1 + ssa/eh.go | 1 + 3 files changed, 12 insertions(+) create mode 100644 cl/_testrt/nextblock/in.go create mode 100644 cl/_testrt/nextblock/out.ll diff --git a/cl/_testrt/nextblock/in.go b/cl/_testrt/nextblock/in.go new file mode 100644 index 00000000..667ac314 --- /dev/null +++ b/cl/_testrt/nextblock/in.go @@ -0,0 +1,10 @@ +package main + +func main() { + syms := []int{} + for range syms { + } + defer println("bye") + for range syms { + } +} diff --git a/cl/_testrt/nextblock/out.ll b/cl/_testrt/nextblock/out.ll new file mode 100644 index 00000000..1c8a0e79 --- /dev/null +++ b/cl/_testrt/nextblock/out.ll @@ -0,0 +1 @@ +; \ No newline at end of file diff --git a/ssa/eh.go b/ssa/eh.go index 7b097005..902aabac 100644 --- a/ssa/eh.go +++ b/ssa/eh.go @@ -86,6 +86,7 @@ const ( func (p Function) deferInitBuilder() (b Builder, next BasicBlock) { b = p.NewBuilder() next = b.setBlockMoveLast(p.blks[0]) + p.blks[0].last = next.last return }