diff --git a/src/compiler/sema_decls.c b/src/compiler/sema_decls.c index 0fd94dff7..9e64fc698 100644 --- a/src/compiler/sema_decls.c +++ b/src/compiler/sema_decls.c @@ -2109,7 +2109,7 @@ bool sema_analyse_var_decl_ct(SemaContext *context, Decl *decl) } if ((init = decl->var.init_expr)) { - if (!sema_analyse_expr_lvalue(context, init)) return false; + if (!sema_analyse_expr_lvalue_fold_const(context, init)) return false; if (init->expr_kind != EXPR_TYPEINFO) { SEMA_ERROR(decl->var.init_expr, "Expected a type assigned to %s.", decl->name); diff --git a/src/compiler/sema_expr.c b/src/compiler/sema_expr.c index c43051099..adec59cf7 100644 --- a/src/compiler/sema_expr.c +++ b/src/compiler/sema_expr.c @@ -1234,7 +1234,7 @@ static inline bool sema_expr_analyse_hash_identifier(SemaContext *context, Expr expr_replace(expr, expr_macro_copy(decl->var.init_expr)); REMINDER("Remove analysis for hash"); - if (!sema_analyse_expr_lvalue(decl->var.hash_var.context, expr)) + if (!sema_analyse_expr_lvalue_fold_const(decl->var.hash_var.context, expr)) { // Poison the decl so we don't evaluate twice. decl_poison(decl); @@ -1794,7 +1794,7 @@ static inline bool sema_expr_analyse_call_invocation(SemaContext *context, Expr break; case VARDECL_PARAM_CT_TYPE: // $Foo - if (!sema_analyse_expr_lvalue(context, arg)) return false; + if (!sema_analyse_expr_lvalue_fold_const(context, arg)) return false; if (arg->expr_kind != EXPR_TYPEINFO) { SEMA_ERROR(arg, "A type, like 'int' or 'double' was expected for the parameter '%s'.", param->name); @@ -2291,7 +2291,7 @@ static inline bool sema_expr_analyse_generic_call(SemaContext *context, Expr *ca Decl *param = func_params[i + offset]; if (param->var.kind == VARDECL_PARAM_CT_TYPE) { - if (!sema_analyse_expr_lvalue(context, arg)) return false; + if (!sema_analyse_expr_lvalue_fold_const(context, arg)) return false; if (arg->expr_kind != EXPR_TYPEINFO) { SEMA_ERROR(arg, "A type, like 'int' or 'double' was expected for the parameter '%s'.", param->name); @@ -2755,7 +2755,7 @@ static inline bool sema_expr_analyse_call(SemaContext *context, Expr *expr) { Expr *func_expr = exprptr(expr->call_expr.function); - if (!sema_analyse_expr_lvalue(context, func_expr)) return false; + if (!sema_analyse_expr_lvalue_fold_const(context, func_expr)) return false; if (func_expr->expr_kind == EXPR_MACRO_BODY_EXPANSION) { return sema_analyse_body_expansion(context, expr); @@ -3017,6 +3017,66 @@ static inline ConstInitializer *initializer_for_index(ConstInitializer *initiali } UNREACHABLE } + +static inline void sema_expr_from_zero_const(Expr *expr, Type *type) +{ + expr->expr_kind = EXPR_CONST; + expr->const_expr.narrowable = true; + type = type->canonical; + switch (type->type_kind) + { + case TYPE_POISONED: + case TYPE_VOID: + UNREACHABLE + case ALL_INTS: + expr_const_set_int(&expr->const_expr, 0, type->type_kind); + break; + case ALL_FLOATS: + expr_const_set_float(&expr->const_expr, 0, type->type_kind); + break; + case TYPE_BOOL: + expr_const_set_bool(&expr->const_expr, false); + break; + case TYPE_POINTER: + case TYPE_FAULTTYPE: + case TYPE_ANY: + case TYPE_ANYERR: + case TYPE_TYPEID: + expr_const_set_null(&expr->const_expr); + break; + case TYPE_ENUM: + expr->const_expr.const_kind = CONST_ENUM; + expr->const_expr.enum_val = type->decl->enums.values[0]; + break; + case TYPE_FUNC: + case TYPE_TYPEDEF: + case TYPE_FAILABLE_ANY: + case TYPE_FAILABLE: + case TYPE_TYPEINFO: + UNREACHABLE + case TYPE_STRUCT: + case TYPE_UNION: + case TYPE_BITSTRUCT: + case TYPE_ARRAY: + case TYPE_SUBARRAY: + case TYPE_INFERRED_ARRAY: + case TYPE_FLEXIBLE_ARRAY: + case TYPE_UNTYPED_LIST: + case TYPE_VECTOR: + { + ConstInitializer *init = CALLOCS(ConstInitializer); + init->kind = CONST_INIT_ZERO; + init->type = type; + expr_set_as_const_list(expr, init); + break; + } + case TYPE_DISTINCT: + sema_expr_from_zero_const(expr, type->decl->distinct_decl.base_type); + break; + } + expr->type = type; +} + static inline bool sema_expr_index_const_list(Expr *const_list, Expr *index, Expr *result) { assert(index->expr_kind == EXPR_CONST && index->const_expr.const_kind == CONST_INTEGER); @@ -3030,7 +3090,7 @@ static inline bool sema_expr_index_const_list(Expr *const_list, Expr *index, Exp switch (kind) { case CONST_INIT_ZERO: - expr_rewrite_to_int_const(result, type_int, 0, true); + sema_expr_from_zero_const(result, type_get_indexed_type(const_list->type)); return true; case CONST_INIT_STRUCT: case CONST_INIT_UNION: @@ -3051,7 +3111,7 @@ static inline bool sema_expr_analyse_subscript(SemaContext *context, Expr *expr, // 1. Evaluate the expression to index. Expr *subscripted = exprptr(expr->subscript_expr.expr); - if (!sema_analyse_expr_lvalue(context, subscripted)) return false; + if (!sema_analyse_expr_lvalue_fold_const(context, subscripted)) return false; sema_deref_array_pointers(subscripted); // 2. Evaluate the index. @@ -3178,7 +3238,7 @@ static inline bool sema_expr_analyse_subscript(SemaContext *context, Expr *expr, } else { - if (current_expr->expr_kind == EXPR_CONST && current_expr->const_expr.list && index->expr_kind == EXPR_CONST) + if (expr_is_const_list(current_expr) && expr_is_const(index)) { if (sema_expr_index_const_list(current_expr, index, expr)) return true; } @@ -3839,6 +3899,62 @@ static bool sema_expr_apply_typeid_property(SemaContext *context, Expr *expr, Ex return false; } +static inline bool sema_expr_fold_to_member(Expr *expr, Expr *parent, Decl *member) +{ + ConstInitializer *init = parent->const_expr.list; + ConstInitializer *result; + switch (init->kind) + { + case CONST_INIT_ZERO: + result = init; + goto EVAL; + case CONST_INIT_STRUCT: + { + Decl **members = init->type->decl->strukt.members; + VECEACH(members, i) + { + if (members[i] == member) + { + result = init->init_struct[i]; + goto EVAL; + } + } + UNREACHABLE + } + case CONST_INIT_UNION: + if (init->type->decl->strukt.members[init->init_union.index] != member) return false; + result = init->init_union.element; + goto EVAL; + case CONST_INIT_VALUE: + case CONST_INIT_ARRAY: + case CONST_INIT_ARRAY_FULL: + case CONST_INIT_ARRAY_VALUE: + UNREACHABLE; + } + UNREACHABLE +EVAL: + switch (result->kind) + { + case CONST_INIT_ZERO: + sema_expr_from_zero_const(expr, result->type); + break; + case CONST_INIT_STRUCT: + case CONST_INIT_UNION: + case CONST_INIT_ARRAY: + case CONST_INIT_ARRAY_FULL: + expr->const_expr.const_kind = CONST_LIST; + expr->const_expr.list = init; + expr->type = init->type; + break; + case CONST_INIT_ARRAY_VALUE: + UNREACHABLE + case CONST_INIT_VALUE: + expr_replace(expr, result->init_value); + break; + } + return true; +} + static bool sema_expr_apply_type_property(SemaContext *context, Expr *expr, Type *type, const char *kw) { assert(type == type->canonical); @@ -3884,7 +4000,7 @@ static inline bool sema_expr_analyse_access(SemaContext *context, Expr *expr) bool was_group = parent->expr_kind == EXPR_GROUP; // 1. Resolve the left hand - if (!sema_analyse_expr_lvalue(context, parent)) return false; + if (!sema_analyse_expr_lvalue_fold_const(context, parent)) return false; // 2. The right hand side may be a @ident or ident Expr *child = expr->access_expr.child; @@ -4093,12 +4209,15 @@ CHECK_DEEPER: { expr->expr_kind = EXPR_BITACCESS; } - + if (member->var.kind == VARDECL_MEMBER && expr_is_const_list(current_parent)) + { + sema_expr_fold_to_member(expr, current_parent, member); + return true; + } // 13. Copy properties. expr->access_expr.parent = current_parent; expr->type = type_add_optional(member->type, failable); expr->access_expr.ref = member; - return true; } @@ -5169,7 +5288,7 @@ static bool sema_expr_analyse_ct_type_identifier_assign(SemaContext *context, Ex return false; } - if (!sema_analyse_expr_lvalue(context, right)) return false; + if (!sema_analyse_expr_lvalue_fold_const(context, right)) return false; if (right->expr_kind != EXPR_TYPEINFO) { @@ -6393,7 +6512,7 @@ static bool sema_expr_analyse_addr(SemaContext *context, Expr *expr) goto REDO; case EXPR_SUBSCRIPT: inner->expr_kind = EXPR_SUBSCRIPT_ADDR; - if (!sema_analyse_expr_lvalue(context, inner)) return false; + if (!sema_analyse_expr_lvalue_fold_const(context, inner)) return false; expr_replace(expr, inner); return true; default: @@ -7945,7 +8064,7 @@ static inline bool sema_cast_rvalue(SemaContext *context, Expr *expr) bool sema_analyse_ct_expr(SemaContext *context, Expr *expr) { - if (!sema_analyse_expr_lvalue(context, expr)) return false; + if (!sema_analyse_expr_lvalue_fold_const(context, expr)) return false; if (expr->expr_kind == EXPR_TYPEINFO) { Type *cond_val = expr->type_expr->type; @@ -7957,6 +8076,16 @@ bool sema_analyse_ct_expr(SemaContext *context, Expr *expr) return sema_cast_rvalue(context, expr); } +bool sema_analyse_expr_lvalue_fold_const(SemaContext *context, Expr *expr) +{ + if (!sema_analyse_expr_lvalue(context, expr)) return false; + if (expr->expr_kind == EXPR_CT_IDENT) + { + if (!sema_cast_ct_ident_rvalue(context, expr)) return false; + } + return true; +} + bool sema_analyse_expr_lvalue(SemaContext *context, Expr *expr) { switch (expr->resolve_status) diff --git a/src/compiler/sema_internal.h b/src/compiler/sema_internal.h index 8febd1f77..547b0536f 100644 --- a/src/compiler/sema_internal.h +++ b/src/compiler/sema_internal.h @@ -74,6 +74,7 @@ void sema_analysis_pass_functions(Module *module); void sema_analyze_stage(Module *module, AnalysisStage stage); Decl *sema_find_operator(SemaContext *context, Expr *expr, OperatorOverload operator_overload); bool sema_analyse_expr_lvalue(SemaContext *context, Expr *expr); +bool sema_analyse_expr_lvalue_fold_const(SemaContext *context, Expr *expr); bool sema_analyse_ct_expr(SemaContext *context, Expr *expr); bool sema_expr_analyse_macro_call(SemaContext *context, Expr *call_expr, Expr *struct_var, Decl *decl, bool failable); void expr_rewrite_to_int_const(Expr *expr_to_rewrite, Type *type, uint64_t value, bool narrowable); @@ -94,3 +95,8 @@ static inline bool expr_is_const_string(Expr *expr) return expr->expr_kind == EXPR_CONST && expr->const_expr.const_kind == CONST_STRING; } +INLINE bool expr_is_const_list(Expr *expr) +{ + return expr->expr_kind == EXPR_CONST && expr->const_expr.const_kind == CONST_LIST; +} + diff --git a/src/version.h b/src/version.h index 8c8b7ec3c..ba4c3ca44 100644 --- a/src/version.h +++ b/src/version.h @@ -1 +1 @@ -#define COMPILER_VERSION "0.3.20" \ No newline at end of file +#define COMPILER_VERSION "0.3.21" \ No newline at end of file diff --git a/test/test_suite/compile_time/compile_time_access_subscript.c3t b/test/test_suite/compile_time/compile_time_access_subscript.c3t new file mode 100644 index 000000000..651708476 --- /dev/null +++ b/test/test_suite/compile_time/compile_time_access_subscript.c3t @@ -0,0 +1,129 @@ +module test; +import std::io; +struct Abc +{ + float m00, m01, m10, m11; +} + +Abc a = flip(Abc { 1, 2, 3, 4 }); + +macro flip($init) +{ + return Abc { $init.m01, $init.m10, $init.m11, $init.m00 }; +} + +macro check_type($Type) +{ + var $b = $Type[4][4] {}; + $Type z = $b[2][2]; + return z; +} + +enum Blurb { FOO } + +define Bdd = distinct Abc; +fn void main() +{ + var $i = int[4] { 1, 2, 3, 4 }; + var $b = Abc[2] { Abc {}, Abc { 11, 22, 33, 44 }}; + var $c = variant[4] {}; + check_type(int); + check_type(Abc); + check_type(anyerr); + check_type(Blurb); + check_type(int*); + check_type(bool); + check_type(typeid); + check_type(int[<3>]); + check_type(Bdd); + check_type(int[2]); + check_type(int[]); + io::printfln("%d", $b[0].m11); +} + +/* #expect: test.ll + + %z = alloca i32, align 4 + %z1 = alloca %Abc, align 4 + %z2 = alloca i64, align 8 + %z3 = alloca i32, align 4 + %z4 = alloca i32*, align 8 + %z5 = alloca i8, align 1 + %z6 = alloca i64, align 8 + %z7 = alloca <3 x i32>, align 16 + %z8 = alloca %Abc, align 4 + %z9 = alloca [2 x i32], align 4 + %z10 = alloca %"int[]", align 8 + %retparam = alloca i64, align 8 + %taddr = alloca %"char[]", align 8 + %vararg = alloca %"variant[]", align 8 + %varargslots = alloca [1 x %variant], align 16 + %literal = alloca %Abc, align 4 + store i32 0, i32* %z, align 4 + %0 = getelementptr inbounds %Abc, %Abc* %z1, i32 0, i32 0 + store float 0.000000e+00, float* %0, align 4 + %1 = getelementptr inbounds %Abc, %Abc* %z1, i32 0, i32 1 + store float 0.000000e+00, float* %1, align 4 + %2 = getelementptr inbounds %Abc, %Abc* %z1, i32 0, i32 2 + store float 0.000000e+00, float* %2, align 4 + %3 = getelementptr inbounds %Abc, %Abc* %z1, i32 0, i32 3 + store float 0.000000e+00, float* %3, align 4 + store i64 0, i64* %z2, align 8 + store i32 0, i32* %z3, align 4 + store i32* null, i32** %z4, align 8 + store i8 0, i8* %z5, align 1 + store i64 0, i64* %z6, align 8 + store <3 x i32> zeroinitializer, <3 x i32>* %z7, align 16 + %4 = getelementptr inbounds %Abc, %Abc* %z8, i32 0, i32 0 + store float 0.000000e+00, float* %4, align 4 + %5 = getelementptr inbounds %Abc, %Abc* %z8, i32 0, i32 1 + store float 0.000000e+00, float* %5, align 4 + %6 = getelementptr inbounds %Abc, %Abc* %z8, i32 0, i32 2 + store float 0.000000e+00, float* %6, align 4 + %7 = getelementptr inbounds %Abc, %Abc* %z8, i32 0, i32 3 + store float 0.000000e+00, float* %7, align 4 + %8 = getelementptr inbounds [2 x i32], [2 x i32]* %z9, i64 0, i64 0 + store i32 0, i32* %8, align 4 + %9 = getelementptr inbounds [2 x i32], [2 x i32]* %z9, i64 0, i64 1 + store i32 0, i32* %9, align 4 + %10 = bitcast %"int[]"* %z10 to i8* + call void @llvm.memset.p0i8.i64(i8* align 8 %10, i8 0, i64 16, i1 false) + store %"char[]" { i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i32 0, i32 0), i64 2 }, %"char[]"* %taddr, align 8 + %11 = bitcast %"char[]"* %taddr to { i8*, i64 }* + %12 = getelementptr inbounds { i8*, i64 }, { i8*, i64 }* %11, i32 0, i32 0 + %lo = load i8*, i8** %12, align 8 + %13 = getelementptr inbounds { i8*, i64 }, { i8*, i64 }* %11, i32 0, i32 1 + %hi = load i64, i64* %13, align 8 + %14 = getelementptr inbounds %Abc, %Abc* %literal, i32 0, i32 0 + store float 0.000000e+00, float* %14, align 4 + %15 = getelementptr inbounds %Abc, %Abc* %literal, i32 0, i32 1 + store float 0.000000e+00, float* %15, align 4 + %16 = getelementptr inbounds %Abc, %Abc* %literal, i32 0, i32 2 + store float 0.000000e+00, float* %16, align 4 + %17 = getelementptr inbounds %Abc, %Abc* %literal, i32 0, i32 3 + store float 0.000000e+00, float* %17, align 4 + %18 = bitcast %Abc* %literal to i8* + %19 = insertvalue %variant undef, i8* %18, 0 + %20 = insertvalue %variant %19, i64 ptrtoint (%.introspect* @"ct$test_Abc" to i64), 1 + %21 = getelementptr inbounds [1 x %variant], [1 x %variant]* %varargslots, i64 0, i64 0 + store %variant %20, %variant* %21, align 16 + %22 = getelementptr inbounds %"variant[]", %"variant[]"* %vararg, i32 0, i32 1 + store i64 1, i64* %22, align 8 + %23 = getelementptr inbounds %"variant[]", %"variant[]"* %vararg, i32 0, i32 0 + %24 = bitcast [1 x %variant]* %varargslots to %variant* + store %variant* %24, %variant** %23, align 8 + %25 = bitcast %"variant[]"* %vararg to { i8*, i64 }* + %26 = getelementptr inbounds { i8*, i64 }, { i8*, i64 }* %25, i32 0, i32 0 + %lo11 = load i8*, i8** %26, align 8 + %27 = getelementptr inbounds { i8*, i64 }, { i8*, i64 }* %25, i32 0, i32 1 + %hi12 = load i64, i64* %27, align 8 + %28 = call i64 @std_io_printfln(i64* %retparam, i8* %lo, i64 %hi, i8* %lo11, i64 %hi12) + %not_err = icmp eq i64 %28, 0 + br i1 %not_err, label %after_check, label %voiderr + +after_check: ; preds = %entry + br label %voiderr + +voiderr: ; preds = %after_check, %entry + ret void +} diff --git a/test/test_suite2/compile_time/compile_time_access_subscript.c3t b/test/test_suite2/compile_time/compile_time_access_subscript.c3t new file mode 100644 index 000000000..15d6aaa3c --- /dev/null +++ b/test/test_suite2/compile_time/compile_time_access_subscript.c3t @@ -0,0 +1,124 @@ +module test; +import std::io; +struct Abc +{ + float m00, m01, m10, m11; +} + +Abc a = flip(Abc { 1, 2, 3, 4 }); + +macro flip($init) +{ + return Abc { $init.m01, $init.m10, $init.m11, $init.m00 }; +} + +macro check_type($Type) +{ + var $b = $Type[4][4] {}; + $Type z = $b[2][2]; + return z; +} + +enum Blurb { FOO } + +define Bdd = distinct Abc; +fn void main() +{ + var $i = int[4] { 1, 2, 3, 4 }; + var $b = Abc[2] { Abc {}, Abc { 11, 22, 33, 44 }}; + var $c = variant[4] {}; + check_type(int); + check_type(Abc); + check_type(anyerr); + check_type(Blurb); + check_type(int*); + check_type(bool); + check_type(typeid); + check_type(int[<3>]); + check_type(Bdd); + check_type(int[2]); + check_type(int[]); + io::printfln("%d", $b[0].m11); +} + +/* #expect: test.ll + + %z = alloca i32, align 4 + %z1 = alloca %Abc, align 4 + %z2 = alloca i64, align 8 + %z3 = alloca i32, align 4 + %z4 = alloca ptr, align 8 + %z5 = alloca i8, align 1 + %z6 = alloca i64, align 8 + %z7 = alloca <3 x i32>, align 16 + %z8 = alloca %Abc, align 4 + %z9 = alloca [2 x i32], align 4 + %z10 = alloca %"int[]", align 8 + %retparam = alloca i64, align 8 + %taddr = alloca %"char[]", align 8 + %vararg = alloca %"variant[]", align 8 + %varargslots = alloca [1 x %variant], align 16 + %literal = alloca %Abc, align 4 + store i32 0, ptr %z, align 4 + %0 = getelementptr inbounds %Abc, ptr %z1, i32 0, i32 0 + store float 0.000000e+00, ptr %0, align 4 + %1 = getelementptr inbounds %Abc, ptr %z1, i32 0, i32 1 + store float 0.000000e+00, ptr %1, align 4 + %2 = getelementptr inbounds %Abc, ptr %z1, i32 0, i32 2 + store float 0.000000e+00, ptr %2, align 4 + %3 = getelementptr inbounds %Abc, ptr %z1, i32 0, i32 3 + store float 0.000000e+00, ptr %3, align 4 + store i64 0, ptr %z2, align 8 + store i32 0, ptr %z3, align 4 + store ptr null, ptr %z4, align 8 + store i8 0, ptr %z5, align 1 + store i64 0, ptr %z6, align 8 + store <3 x i32> zeroinitializer, ptr %z7, align 16 + %4 = getelementptr inbounds %Abc, ptr %z8, i32 0, i32 0 + store float 0.000000e+00, ptr %4, align 4 + %5 = getelementptr inbounds %Abc, ptr %z8, i32 0, i32 1 + store float 0.000000e+00, ptr %5, align 4 + %6 = getelementptr inbounds %Abc, ptr %z8, i32 0, i32 2 + store float 0.000000e+00, ptr %6, align 4 + %7 = getelementptr inbounds %Abc, ptr %z8, i32 0, i32 3 + store float 0.000000e+00, ptr %7, align 4 + %8 = getelementptr inbounds [2 x i32], ptr %z9, i64 0, i64 0 + store i32 0, ptr %8, align 4 + %9 = getelementptr inbounds [2 x i32], ptr %z9, i64 0, i64 1 + store i32 0, ptr %9, align 4 + call void @llvm.memset.p0.i64(ptr align 8 %z10, i8 0, i64 16, i1 false) + store %"char[]" { ptr @.str, i64 2 }, ptr %taddr, align 8 + %10 = getelementptr inbounds { ptr, i64 }, ptr %taddr, i32 0, i32 0 + %lo = load ptr, ptr %10, align 8 + %11 = getelementptr inbounds { ptr, i64 }, ptr %taddr, i32 0, i32 1 + %hi = load i64, ptr %11, align 8 + %12 = getelementptr inbounds %Abc, ptr %literal, i32 0, i32 0 + store float 0.000000e+00, ptr %12, align 4 + %13 = getelementptr inbounds %Abc, ptr %literal, i32 0, i32 1 + store float 0.000000e+00, ptr %13, align 4 + %14 = getelementptr inbounds %Abc, ptr %literal, i32 0, i32 2 + store float 0.000000e+00, ptr %14, align 4 + %15 = getelementptr inbounds %Abc, ptr %literal, i32 0, i32 3 + store float 0.000000e+00, ptr %15, align 4 + %16 = insertvalue %variant undef, ptr %literal, 0 + %17 = insertvalue %variant %16, i64 ptrtoint (ptr @"ct$test_Abc" to i64), 1 + %18 = getelementptr inbounds [1 x %variant], ptr %varargslots, i64 0, i64 0 + store %variant %17, ptr %18, align 16 + %19 = getelementptr inbounds %"variant[]", ptr %vararg, i32 0, i32 1 + store i64 1, ptr %19, align 8 + %20 = getelementptr inbounds %"variant[]", ptr %vararg, i32 0, i32 0 + store ptr %varargslots, ptr %20, align 8 + %21 = getelementptr inbounds { ptr, i64 }, ptr %vararg, i32 0, i32 0 + %lo11 = load ptr, ptr %21, align 8 + %22 = getelementptr inbounds { ptr, i64 }, ptr %vararg, i32 0, i32 1 + %hi12 = load i64, ptr %22, align 8 + %23 = call i64 @std_io_printfln(ptr %retparam, ptr %lo, i64 %hi, ptr %lo11, i64 %hi12) + %not_err = icmp eq i64 %23, 0 + br i1 %not_err, label %after_check, label %voiderr + +after_check: ; preds = %entry + br label %voiderr + +voiderr: ; preds = %after_check, %entry + ret void +}