aboutsummaryrefslogtreecommitdiff
path: root/src/codegen.cpp
diff options
context:
space:
mode:
authorAndrew Kelley <superjoe30@gmail.com>2016-12-19 00:04:51 -0500
committerAndrew Kelley <superjoe30@gmail.com>2016-12-19 00:04:51 -0500
commit09c34352f8a87ed9597b4af0de564aa7d831761a (patch)
tree6ab441882b48c972b9dd61d0797e4671e5af341f /src/codegen.cpp
parent956ff8a7f98cad2f5f9b043e8a896609ea41f952 (diff)
downloadzig-09c34352f8a87ed9597b4af0de564aa7d831761a.tar.gz
zig-09c34352f8a87ed9597b4af0de564aa7d831761a.zip
IR: if and switch guaranteed compile time if target expr is
Diffstat (limited to 'src/codegen.cpp')
-rw-r--r--src/codegen.cpp5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/codegen.cpp b/src/codegen.cpp
index ef72fd76a0..ada9bebf23 100644
--- a/src/codegen.cpp
+++ b/src/codegen.cpp
@@ -1646,8 +1646,6 @@ static LLVMValueRef ir_render_ctz(CodeGen *g, IrExecutable *executable, IrInstru
}
static LLVMValueRef ir_render_switch_br(CodeGen *g, IrExecutable *executable, IrInstructionSwitchBr *instruction) {
- assert(!instruction->is_inline);
-
LLVMValueRef target_value = ir_llvm_value(g, instruction->target_value);
LLVMBasicBlockRef else_block = instruction->else_block->llvm_block;
LLVMValueRef switch_instr = LLVMBuildSwitch(g->builder, target_value, else_block, instruction->case_count);
@@ -2197,6 +2195,7 @@ static LLVMValueRef ir_render_instruction(CodeGen *g, IrExecutable *executable,
case IrInstructionIdMemberCount:
case IrInstructionIdAlignOf:
case IrInstructionIdFnProto:
+ case IrInstructionIdTestComptime:
zig_unreachable();
case IrInstructionIdReturn:
return ir_render_return(g, executable, (IrInstructionReturn *)instruction);
@@ -2897,7 +2896,7 @@ static void do_code_gen(CodeGen *g) {
if (!type_has_bits(var->type)) {
continue;
}
- if (var->is_inline)
+ if (ir_get_var_is_comptime(var))
continue;
if (var->src_arg_index == SIZE_MAX) {