aboutsummaryrefslogtreecommitdiff
path: root/src/ir.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/ir.cpp')
-rw-r--r--src/ir.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/ir.cpp b/src/ir.cpp
index f4b727412e..e2bcbcffee 100644
--- a/src/ir.cpp
+++ b/src/ir.cpp
@@ -12070,6 +12070,12 @@ static ZigType *ir_analyze_bit_shift(IrAnalyze *ira, IrInstructionBinOp *bin_op_
ir_add_error(ira, &bin_op_instruction->base,
buf_sprintf("LHS of shift must be an integer type, or RHS must be compile-time known"));
return ira->codegen->builtin_types.entry_invalid;
+ } else if (instr_is_comptime(casted_op2) && bigint_cmp_zero(&casted_op2->value.data.x_bigint) == CmpEQ) {
+ IrInstruction *result = ir_build_cast(&ira->new_irb, bin_op_instruction->base.scope,
+ bin_op_instruction->base.source_node, op1->value.type, op1, CastOpNoop);
+ result->value.type = op1->value.type;
+ ir_link_new_instruction(result, &bin_op_instruction->base);
+ return result->value.type;
}
ir_build_bin_op_from(&ira->new_irb, &bin_op_instruction->base, op_id,