aboutsummaryrefslogtreecommitdiff
path: root/src/ir.cpp
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2019-06-12 15:02:46 -0400
committerAndrew Kelley <andrew@ziglang.org>2019-06-12 15:02:46 -0400
commit1526d89711c90a4a98dfecb6d3c64f28c3ab7da6 (patch)
treec7e2354a7ea33cc0d5a17cca810d8a8b21de28ef /src/ir.cpp
parent35352e0f489882b9d5919ffd569e7dcda990f39b (diff)
downloadzig-1526d89711c90a4a98dfecb6d3c64f28c3ab7da6.tar.gz
zig-1526d89711c90a4a98dfecb6d3c64f28c3ab7da6.zip
fix `@bitCast` with runtime scalar and dest result loc var
Diffstat (limited to 'src/ir.cpp')
-rw-r--r--src/ir.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/ir.cpp b/src/ir.cpp
index d0ad7f944c..0f62c198f6 100644
--- a/src/ir.cpp
+++ b/src/ir.cpp
@@ -24232,11 +24232,13 @@ static IrInstruction *ir_analyze_instruction_end_expr(IrAnalyze *ira, IrInstruct
static IrInstruction *ir_analyze_instruction_bit_cast_src(IrAnalyze *ira, IrInstructionBitCastSrc *instruction) {
IrInstruction *operand = instruction->operand->child;
- if (type_is_invalid(operand->value.type) ||
- instruction->result_loc_bit_cast->parent->gen_instruction == nullptr)
- {
+ if (type_is_invalid(operand->value.type))
return operand;
- }
+
+ IrInstruction *result_loc = ir_resolve_result(ira, &instruction->base,
+ &instruction->result_loc_bit_cast->base, operand->value.type, operand);
+ if (result_loc != nullptr && (type_is_invalid(result_loc->value.type) || instr_is_unreachable(result_loc)))
+ return result_loc;
return instruction->result_loc_bit_cast->parent->gen_instruction;
}