From ccf8b378b35a478a315ccacd7dbbeaea6658cead Mon Sep 17 00:00:00 2001 From: Jaden Weiss Date: Wed, 1 Apr 2020 17:51:30 -0400 Subject: compiler: track PHI nodes --- compiler/compiler.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'compiler') diff --git a/compiler/compiler.go b/compiler/compiler.go index 33b5ab4fd..eaf73e221 100644 --- a/compiler/compiler.go +++ b/compiler/compiler.go @@ -1025,6 +1025,18 @@ func (b *builder) createFunctionDefinition() { phi.llvm.AddIncoming([]llvm.Value{llvmVal}, []llvm.BasicBlock{llvmBlock}) } } + + if b.NeedsStackObjects() { + // Track phi nodes. + for _, phi := range b.phis { + insertPoint := llvm.NextInstruction(phi.llvm) + for !insertPoint.IsAPHINode().IsNil() { + insertPoint = llvm.NextInstruction(insertPoint) + } + b.SetInsertPointBefore(insertPoint) + b.trackValue(phi.llvm) + } + } } // createInstruction builds the LLVM IR equivalent instructions for the -- cgit v1.2.3