aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTimon Kruiper <timonkruiper@gmail.com>2021-03-23 16:06:15 +0100
committerAndrew Kelley <andrew@ziglang.org>2021-03-23 11:42:46 -0700
commit982df37135a5ce2e5e93067d716f096ec614f3ef (patch)
treedc8906662331e00bd897e69fe3ccfa227631a70e
parentd73b0473a1df98703d5c742d59e57e225cfa7ba4 (diff)
downloadzig-982df37135a5ce2e5e93067d716f096ec614f3ef.tar.gz
zig-982df37135a5ce2e5e93067d716f096ec614f3ef.zip
stage2: handle void value in genRet in LLVM backend
-rw-r--r--src/codegen/llvm.zig5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/codegen/llvm.zig b/src/codegen/llvm.zig
index e78bd8d103..cd601debda 100644
--- a/src/codegen/llvm.zig
+++ b/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;
}