From 00b44c1da2e553f388bd4c7f7c575beae469d548 Mon Sep 17 00:00:00 2001 From: Dimi Racordon Date: Tue, 27 Aug 2024 11:51:52 +0200 Subject: [PATCH] Fix the code generation of 0-sized stores --- Sources/CodeGen/LLVM/Transpilation.swift | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Sources/CodeGen/LLVM/Transpilation.swift b/Sources/CodeGen/LLVM/Transpilation.swift index 0649c62fc..cc895747b 100644 --- a/Sources/CodeGen/LLVM/Transpilation.swift +++ b/Sources/CodeGen/LLVM/Transpilation.swift @@ -1180,7 +1180,10 @@ extension SwiftyLLVM.Module { /// Inserts the transpilation of `i` at `insertionPoint`. func insert(store i: IR.InstructionID) { let s = m[i] as! IR.Store - insertStore(llvm(s.object), to: llvm(s.target), at: insertionPoint) + let v = llvm(s.object) + if layout.storageSize(of: v.type) > 0 { + insertStore(llvm(s.object), to: llvm(s.target), at: insertionPoint) + } } /// Inserts the transpilation of `i` at `insertionPoint`.