Commit 982df37135

Timon Kruiper <timonkruiper@gmail.com>
2021-03-23 16:06:15
stage2: handle void value in genRet in LLVM backend
1 parent d73b047
Changed files (1)
src
codegen
src/codegen/llvm.zig
@@ -727,6 +727,11 @@ pub const FuncGen = struct {
     }
 
     fn genRet(self: *FuncGen, inst: *Inst.UnOp) !?*const llvm.Value {
+        if (!inst.operand.ty.hasCodeGenBits()) {
+            // TODO: in astgen these instructions should turn into `retvoid` instructions.
+            _ = self.builder.buildRetVoid();
+            return null;
+        }
         _ = self.builder.buildRet(try self.resolveInst(inst.operand));
         return null;
     }