diff --git a/src/compiler/c_codegen.c b/src/compiler/c_codegen.c index b137e20f6..06e2c0379 100644 --- a/src/compiler/c_codegen.c +++ b/src/compiler/c_codegen.c @@ -397,6 +397,8 @@ static void c_emit_expr(GenContext *c, CValue *value, Expr *expr) { case EXPR_PTR_ACCESS: case EXPR_EXT_TRUNC: + case EXPR_MAKE_ANY: + case EXPR_INT_TO_BOOL: break; case EXPR_ACCESS: break; diff --git a/src/compiler/compiler_internal.h b/src/compiler/compiler_internal.h index a0b79f548..6100eacbc 100644 --- a/src/compiler/compiler_internal.h +++ b/src/compiler/compiler_internal.h @@ -1122,6 +1122,17 @@ typedef struct bool is_signed; } ExprExtTrunc; +typedef struct +{ + Expr *inner; + bool negate; +} ExprIntToBool; + +typedef struct +{ + Expr *inner; + Expr *typeid; +} ExprMakeAny; struct Expr_ { Type *type; @@ -1157,6 +1168,7 @@ struct Expr_ ExprFuncBlock expr_block; // 4 ExprCompoundLiteral expr_compound_literal; // 16 Expr **expression_list; // 8 + ExprIntToBool int_to_bool_expr; ExprExtTrunc ext_trunc_expr; ExprGenericIdent generic_ident_expr; ExprDefaultArg default_arg_expr; @@ -1164,6 +1176,7 @@ struct Expr_ ExprIdentifier identifier_expr; // 24 Expr** initializer_list; // 8 Expr *inner_expr; // 8 + ExprMakeAny make_any_expr; Decl *lambda_expr; // 8 ExprMacroBlock macro_block; // 24 ExprMacroBody macro_body_expr; // 16 @@ -2125,7 +2138,6 @@ bool may_cast(SemaContext *cc, Expr *expr, Type *to_type, bool is_explicit, bool void cast_no_check(SemaContext *context, Expr *expr, Type *to_type, bool add_optional); bool cast_to_index(SemaContext *context, Expr *index, Type *subscripted_type); -CastKind cast_to_bool_kind(Type *type); const char *llvm_codegen(void *context); const char *tilde_codegen(void *context); @@ -2956,6 +2968,37 @@ static inline Type *type_flat_distinct_inline(Type *type) return type; } +static inline Type *type_flatten_to_int(Type *type) +{ + while (1) + { + type = type->canonical; + switch (type->type_kind) + { + case TYPE_DISTINCT: + type = type->decl->distinct->type; + break; + case TYPE_OPTIONAL: + type = type->optional; + break; + case TYPE_BITSTRUCT: + type = type->decl->strukt.container_type->type; + break; + case TYPE_ENUM: + type = type->decl->enums.type_info->type; + break; + case TYPE_VECTOR: + ASSERT0(type_is_integer(type->array.base)); + return type; + case TYPE_TYPEDEF: + UNREACHABLE + default: + ASSERT0(type_is_integer(type)); + return type; + } + } +} + static inline Type *type_flatten(Type *type) { while (1) @@ -3280,6 +3323,9 @@ static inline void expr_set_span(Expr *expr, SourceSpan loc) expr->span = loc; switch (expr->expr_kind) { + case EXPR_INT_TO_BOOL: + expr_set_span(expr->int_to_bool_expr.inner, loc); + return; case EXPR_EXT_TRUNC: expr_set_span(expr->ext_trunc_expr.inner, loc); return; @@ -3310,6 +3356,10 @@ static inline void expr_set_span(Expr *expr, SourceSpan loc) case EXPR_DESIGNATED_INITIALIZER_LIST: expr_list_set_span(expr->designated_init_list, loc); return; + case EXPR_MAKE_ANY: + expr_set_span(expr->make_any_expr.inner, loc); + expr_set_span(expr->make_any_expr.typeid, loc); + return; case EXPR_SPLAT: expr_set_span(expr->inner_expr, loc); return; @@ -3600,6 +3650,45 @@ INLINE void expr_rewrite_ptr_access(Expr *expr, Type *type) expr->type = type; } +INLINE void expr_rewrite_int_to_bool(Expr *expr, bool negate) +{ + if (expr_is_const(expr)) + { + switch (expr->const_expr.const_kind) + { + case CONST_FLOAT: + case CONST_BOOL: + case CONST_ENUM: + case CONST_BYTES: + case CONST_STRING: + case CONST_SLICE: + case CONST_INITIALIZER: + case CONST_UNTYPED_LIST: + case CONST_MEMBER: + UNREACHABLE + case CONST_ERR: + expr_rewrite_const_bool(expr, type_bool, expr->const_expr.enum_err_val != NULL); + return; + case CONST_INTEGER: + expr_rewrite_const_bool(expr, type_bool, !int_is_zero(expr->const_expr.ixx)); + return; + case CONST_POINTER: + expr_rewrite_const_bool(expr, type_bool, expr->const_expr.ptr != 0); + return; + case CONST_TYPEID: + expr_rewrite_const_bool(expr, type_bool, expr->type != NULL); + return; + case CONST_REF: + expr_rewrite_const_bool(expr, type_bool, true); + return; + } + UNREACHABLE + } + Expr *inner = expr_copy(expr); + expr->expr_kind = EXPR_INT_TO_BOOL; + expr->int_to_bool_expr = (ExprIntToBool) { .inner = inner, .negate = negate }; + expr->type = type_bool; +} INLINE void expr_rewrite_ext_trunc(Expr *expr, Type *type, bool is_signed) { diff --git a/src/compiler/copying.c b/src/compiler/copying.c index 1fef317e1..dd84e6fb2 100644 --- a/src/compiler/copying.c +++ b/src/compiler/copying.c @@ -335,6 +335,9 @@ Expr *copy_expr(CopyStruct *c, Expr *source_expr) case EXPR_EXT_TRUNC: MACRO_COPY_EXPR(expr->ext_trunc_expr.inner); return expr; + case EXPR_INT_TO_BOOL: + MACRO_COPY_EXPR(expr->int_to_bool_expr.inner); + return expr; case EXPR_NOP: case EXPR_BUILTIN: case EXPR_RETVAL: @@ -475,6 +478,10 @@ Expr *copy_expr(CopyStruct *c, Expr *source_expr) case EXPR_PTR_ACCESS: MACRO_COPY_EXPR(expr->inner_expr); return expr; + case EXPR_MAKE_ANY: + MACRO_COPY_EXPR(expr->make_any_expr.inner); + MACRO_COPY_EXPR(expr->make_any_expr.typeid); + return expr; case EXPR_DEFAULT_ARG: MACRO_COPY_EXPR(expr->default_arg_expr.inner); return expr; diff --git a/src/compiler/enums.h b/src/compiler/enums.h index 24fb119a4..dadec433b 100644 --- a/src/compiler/enums.h +++ b/src/compiler/enums.h @@ -534,7 +534,6 @@ typedef enum typedef enum { - CAST_ANYBOOL, CAST_APTSA, CAST_ARRVEC, CAST_BOOLBOOL, @@ -545,25 +544,20 @@ typedef enum CAST_EREU, CAST_ERPTR, CAST_ERROR, - CAST_EUBOOL, CAST_EUER, CAST_FPBOOL, CAST_FPFP, CAST_FPINT, - CAST_INTINT, CAST_INTBOOL, CAST_INTENUM, CAST_INTFP, CAST_IDPTR, - CAST_IDBOOL, - CAST_PTRANY, CAST_PTRBOOL, CAST_PTRPTR, CAST_PTRINT, CAST_SLBOOL, CAST_SLSL, CAST_SLARR, - CAST_STRPTR, CAST_STINLINE, CAST_VECARR, CAST_VOID, @@ -788,6 +782,7 @@ typedef enum EXPR_MACRO_BLOCK, EXPR_MACRO_BODY, EXPR_MACRO_BODY_EXPANSION, + EXPR_MAKE_ANY, EXPR_MEMBER_GET, EXPR_NAMED_ARGUMENT, EXPR_NOP, @@ -819,6 +814,7 @@ typedef enum EXPR_UNARY, EXPR_VASPLAT, EXPR_EXT_TRUNC, + EXPR_INT_TO_BOOL, EXPR_LAST = EXPR_VASPLAT } ExprKind; diff --git a/src/compiler/expr.c b/src/compiler/expr.c index b5e86b00f..4ce5f2767 100644 --- a/src/compiler/expr.c +++ b/src/compiler/expr.c @@ -92,6 +92,7 @@ bool expr_may_addr(Expr *expr) case EXPR_BUILTIN_ACCESS: case EXPR_CALL: case EXPR_CAST: + case EXPR_MAKE_ANY: case EXPR_CATCH_UNWRAP: case EXPR_COMPOUND_LITERAL: case EXPR_COND: @@ -131,6 +132,7 @@ bool expr_may_addr(Expr *expr) case EXPR_TYPEID_INFO: case EXPR_VASPLAT: case EXPR_EXT_TRUNC: + case EXPR_INT_TO_BOOL: return false; } UNREACHABLE @@ -188,6 +190,10 @@ bool expr_is_runtime_const(Expr *expr) case EXPR_COND: case EXPR_PTR_ACCESS: return false; + case EXPR_MAKE_ANY: + if (!expr_is_runtime_const(expr->make_any_expr.typeid)) return false; + expr = expr->make_any_expr.inner; + goto RETRY; case EXPR_ACCESS: expr = expr->access_expr.parent; goto RETRY; @@ -207,6 +213,8 @@ bool expr_is_runtime_const(Expr *expr) return exprid_is_runtime_const(expr->builtin_access_expr.inner); case EXPR_CAST: return expr_cast_is_runtime_const(expr); + case EXPR_INT_TO_BOOL: + return expr_is_runtime_const(expr->int_to_bool_expr.inner); case EXPR_EXT_TRUNC: return expr_is_runtime_const(expr->ext_trunc_expr.inner); case EXPR_CONST: @@ -337,10 +345,8 @@ static inline bool expr_cast_is_runtime_const(Expr *expr) case CAST_ERROR: UNREACHABLE case CAST_INTENUM: - case CAST_EUBOOL: case CAST_EUER: case CAST_EREU: - case CAST_STRPTR: case CAST_PTRBOOL: case CAST_BOOLFP: case CAST_BOOLBOOL: @@ -353,21 +359,16 @@ static inline bool expr_cast_is_runtime_const(Expr *expr) case CAST_STINLINE: case CAST_VECARR: case CAST_ARRVEC: - case CAST_INTINT: return exprid_is_runtime_const(expr->cast_expr.expr); case CAST_INTPTR: case CAST_PTRPTR: case CAST_APTSA: case CAST_SLSL: case CAST_VOID: - case CAST_ANYBOOL: case CAST_ERPTR: case CAST_IDPTR: - case CAST_IDBOOL: case CAST_EXPVEC: return exprid_is_runtime_const(expr->cast_expr.expr); - case CAST_PTRANY: - return exprid_is_runtime_const(expr->cast_expr.expr); case CAST_PTRINT: case CAST_INTARRBS: case CAST_BSINTARR: @@ -604,8 +605,12 @@ bool expr_is_pure(Expr *expr) case EXPR_BENCHMARK_HOOK: case EXPR_TEST_HOOK: return false; + case EXPR_MAKE_ANY: + return expr_is_pure(expr->make_any_expr.inner) && expr_is_pure(expr->make_any_expr.typeid); case EXPR_PTR_ACCESS: return expr_is_pure(expr->inner_expr); + case EXPR_INT_TO_BOOL: + return expr_is_pure(expr->int_to_bool_expr.inner); case EXPR_EXT_TRUNC: return expr_is_pure(expr->ext_trunc_expr.inner); case EXPR_OTHER_CONTEXT: diff --git a/src/compiler/json_output.c b/src/compiler/json_output.c index 1d3e57b3d..5b8ffbd19 100644 --- a/src/compiler/json_output.c +++ b/src/compiler/json_output.c @@ -241,8 +241,11 @@ void print_var_expr(FILE *file, Expr *expr) return; } - switch (expr->expr_kind) + switch ( expr->expr_kind) { + case EXPR_MAKE_ANY: + fputs("TODO: MAKE_ANY", file); + break; case EXPR_BITASSIGN: case EXPR_BITACCESS: case EXPR_ACCESS: @@ -254,6 +257,10 @@ void print_var_expr(FILE *file, Expr *expr) print_var_expr(file, expr->access_expr.parent); fputs(".ptr", file); break; + case EXPR_INT_TO_BOOL: + fputs(expr->int_to_bool_expr.negate ? "!" : "!!", file); + print_var_expr(file, expr->inner_expr); + break; case EXPR_EXT_TRUNC: TODO case EXPR_BINARY: diff --git a/src/compiler/llvm_codegen_builtins.c b/src/compiler/llvm_codegen_builtins.c index 4dbe68b9b..3344623dd 100644 --- a/src/compiler/llvm_codegen_builtins.c +++ b/src/compiler/llvm_codegen_builtins.c @@ -758,29 +758,6 @@ static void llvm_emit_veccomp(GenContext *c, BEValue *value, Expr *expr, Builtin } -static inline void llvm_emit_any_make(GenContext *c, BEValue *value, Expr *expr) -{ - Expr **args = expr->call_expr.arguments; - Expr *typeid = args[1]; - if (expr_is_const(typeid) && typeid->const_expr.typeid == type_void) - { - llvm_value_set(value, llvm_get_zero(c, type_any), type_any); - return; - } - BEValue ptr; - llvm_emit_expr(c, &ptr, args[0]); - llvm_value_rvalue(c, &ptr); - BEValue typeid_value; - llvm_emit_expr(c, &typeid_value, typeid); - llvm_value_rvalue(c, &typeid_value); - LLVMValueRef var = llvm_get_undef(c, type_any); - var = llvm_emit_insert_value(c, var, ptr.value, 0); - var = llvm_emit_insert_value(c, var, typeid_value.value, 1); - ASSERT0(!LLVMIsConstant(ptr.value) || !LLVMIsConstant(typeid_value.value) || LLVMIsConstant(var)); - llvm_value_set(value, var, type_any); -} - - void llvm_emit_builtin_call(GenContext *c, BEValue *result_value, Expr *expr) { BuiltinFunction func = exprptr(expr->call_expr.function)->builtin_expr.builtin; @@ -789,8 +766,8 @@ void llvm_emit_builtin_call(GenContext *c, BEValue *result_value, Expr *expr) switch (func) { case BUILTIN_ANY_MAKE: - llvm_emit_any_make(c, result_value, expr); - return; + // Folded in the frontend. + UNREACHABLE case BUILTIN_UNREACHABLE: llvm_emit_unreachable_stmt(c, result_value, expr); return; diff --git a/src/compiler/llvm_codegen_expr.c b/src/compiler/llvm_codegen_expr.c index 5f3c0978e..04eeae929 100644 --- a/src/compiler/llvm_codegen_expr.c +++ b/src/compiler/llvm_codegen_expr.c @@ -1452,25 +1452,10 @@ void llvm_emit_cast(GenContext *c, CastKind cast_kind, Expr *expr, BEValue *valu case CAST_ARRVEC: llvm_emit_array_to_vector_cast(c, value, to_type, from_type); return; - case CAST_PTRANY: - { - llvm_value_rvalue(c, value); - BEValue typeid; - llvm_emit_typeid(c, &typeid, from_type->pointer); - llvm_value_aggregate_two(c, value, to_type, value->value, typeid.value); - return; - } case CAST_VOID: UNREACHABLE; - case CAST_ANYBOOL: - llvm_emit_any_pointer(c, value, value); - llvm_value_rvalue(c, value); - value->value = LLVMBuildIsNotNull(c->builder, value->value, "anybool"); - value->kind = BE_BOOLEAN; - break; case CAST_ERROR: UNREACHABLE - case CAST_STRPTR: case CAST_PTRPTR: llvm_value_rvalue(c, value); break; @@ -1491,14 +1476,6 @@ void llvm_emit_cast(GenContext *c, CastKind cast_kind, Expr *expr, BEValue *valu case CAST_EUER: REMINDER("Improve fault to err comparison"); break; - case CAST_EUBOOL: - case CAST_IDBOOL: - { - BEValue zero; - llvm_value_set_int(c, &zero, type_iptr, 0); - llvm_emit_int_comp(c, value, value, &zero, BINARYOP_NE); - break; - } case CAST_PTRBOOL: llvm_value_rvalue(c, value); value->value = LLVMBuildIsNotNull(c->builder, value->value, "ptrbool"); @@ -1541,9 +1518,6 @@ void llvm_emit_cast(GenContext *c, CastKind cast_kind, Expr *expr, BEValue *valu } value->value = LLVMBuildFPToUI(c->builder, value->value, llvm_get_type(c, to_type), "fpui"); break; - case CAST_INTINT: - llvm_value_ext_trunc(c, value, to_type); - break; case CAST_INTFP: llvm_value_rvalue(c, value); if (type_is_signed(value->type)) @@ -1619,6 +1593,96 @@ void llvm_emit_cast(GenContext *c, CastKind cast_kind, Expr *expr, BEValue *valu value->type = type_lowering(to_type); } +void llvm_emit_bool_cast(GenContext *c, Expr *expr, BEValue *value) +{ + switch (value->type->type_kind) + { + case FLATTENED_TYPES: + // These are not possible due to flattening. + UNREACHABLE + case TYPE_WILDCARD: + case TYPE_BOOL: + value->value = LLVMBuildTrunc(c->builder, value->value, c->bool_type, "boolbool"); + value->kind = BE_BOOLEAN; + return; + case TYPE_FAULTTYPE: + case TYPE_ANYFAULT: + { + BEValue zero; + llvm_value_set_int(c, &zero, type_iptr, 0); + llvm_emit_int_comp(c, value, value, &zero, BINARYOP_NE); + return; + } + case TYPE_SLICE: + llvm_value_fold_optional(c, value); + if (llvm_value_is_addr(value)) + { + value->value = llvm_emit_struct_gep_raw(c, + value->value, + llvm_get_type(c, value->type), + 1, + value->alignment, + &value->alignment); + } + else + { + value->value = llvm_emit_extract_value(c, value->value, 1); + } + value->type = type_lowering(type_usz); + llvm_value_rvalue(c, value); + llvm_emit_int_comp_zero(c, value, value, BINARYOP_NE); + return; + case ALL_INTS: + { + llvm_value_rvalue(c, value); + value->value = LLVMBuildICmp(c->builder, LLVMIntNE, value->value, llvm_get_zero(c, value->type), "intbool"); + value->kind = type_kind_is_any_vector(value->type->type_kind) ? BE_BOOLVECTOR : BE_BOOLEAN; + return; + } + case ALL_FLOATS: + llvm_value_rvalue(c, value); + value->value = LLVMBuildFCmp(c->builder, LLVMRealUNE, value->value, llvm_get_zero(c, value->type), "fpbool"); + value->kind = BE_BOOLEAN; + return; + case TYPE_POINTER: + case TYPE_FUNC_PTR: + llvm_value_rvalue(c, value); + value->value = LLVMBuildIsNotNull(c->builder, value->value, "ptrbool"); + value->kind = BE_BOOLEAN; + return; + case TYPE_ANY: + case TYPE_INTERFACE: + llvm_emit_any_pointer(c, value, value); + llvm_value_rvalue(c, value); + value->value = LLVMBuildIsNotNull(c->builder, value->value, "ptrbool"); + value->kind = BE_BOOLEAN; + return; + case TYPE_BITSTRUCT: + llvm_emit_bitstruct_to_bool(c, value, type_bool, value->type); + return; + case TYPE_INFERRED_ARRAY: + case TYPE_INFERRED_VECTOR: + // These should never be here, type should already be known. + UNREACHABLE + case TYPE_POISONED: + case TYPE_VOID: + case TYPE_STRUCT: + case TYPE_UNION: + case TYPE_FUNC_RAW: + case TYPE_ARRAY: + case TYPE_TYPEID: + case TYPE_TYPEINFO: + case TYPE_VECTOR: + case TYPE_UNTYPED_LIST: + case TYPE_FLEXIBLE_ARRAY: + case TYPE_ENUM: + case TYPE_MEMBER: + // Everything else is an error + UNREACHABLE + } + UNREACHABLE +} + static inline void llvm_emit_cast_expr(GenContext *context, BEValue *be_value, Expr *expr) { if (expr->cast_expr.kind == CAST_VOID) @@ -4769,8 +4833,7 @@ static inline void llvm_emit_elvis_expr(GenContext *c, BEValue *value, Expr *exp LLVMValueRef lhs_value = value->value; if (value->kind != BE_BOOLEAN) { - CastKind cast = cast_to_bool_kind(value->type); - llvm_emit_cast(c, cast, cond, value, type_bool, value->type); + llvm_emit_bool_cast(c, cond, value); } Expr *else_expr = exprptr(expr->ternary_expr.else_expr); @@ -4841,8 +4904,7 @@ void gencontext_emit_ternary_expr(GenContext *c, BEValue *value, Expr *expr) if (value->kind != BE_BOOLEAN) { ASSERT0(is_elvis); - CastKind cast = cast_to_bool_kind(value->type); - llvm_emit_cast(c, cast, cond, value, type_bool, value->type); + llvm_emit_bool_cast(c, cond, value); } Expr *else_expr; @@ -7193,6 +7255,17 @@ void llvm_emit_expr_global_value(GenContext *c, BEValue *value, Expr *expr) ASSERT0(!llvm_value_is_addr(value)); } +static void llvm_emit_int_to_bool(GenContext *c, BEValue *value, Expr *expr) +{ + llvm_emit_expr(c, value, expr->int_to_bool_expr.inner); + llvm_value_rvalue(c, value); + llvm_value_set(value, + expr->int_to_bool_expr.negate + ? LLVMBuildIsNull(c->builder, value->value, "i2nb") + : LLVMBuildIsNotNull(c->builder, value->value, "i2b"), + expr->type); +} + static void llvm_emit_ptr_access(GenContext *c, BEValue *value, Expr *expr) { llvm_emit_expr(c, value, expr->inner_expr); @@ -7208,6 +7281,18 @@ static void llvm_emit_ptr_access(GenContext *c, BEValue *value, Expr *expr) llvm_value_set(value, ptr, expr->type); } +static void llvm_emit_make_any(GenContext *c, BEValue *value, Expr *expr) +{ + + llvm_emit_expr(c, value, expr->make_any_expr.inner); + llvm_value_rvalue(c, value); + BEValue typeid_val; + Expr *typeid = expr->make_any_expr.typeid; + llvm_emit_expr(c, &typeid_val, typeid); + llvm_value_rvalue(c, &typeid_val); + llvm_value_aggregate_two(c, value, expr->type, value->value, typeid_val.value); +} + static void llvm_emit_ext_trunc(GenContext *c, BEValue *value, Expr *expr) { llvm_emit_expr(c, value, expr->ext_trunc_expr.inner); @@ -7237,9 +7322,15 @@ void llvm_emit_expr(GenContext *c, BEValue *value, Expr *expr) case EXPR_MEMBER_GET: case EXPR_NAMED_ARGUMENT: UNREACHABLE + case EXPR_MAKE_ANY: + llvm_emit_make_any(c, value, expr); + return; case EXPR_PTR_ACCESS: llvm_emit_ptr_access(c, value, expr); return; + case EXPR_INT_TO_BOOL: + llvm_emit_int_to_bool(c, value, expr); + return; case EXPR_EXT_TRUNC: llvm_emit_ext_trunc(c, value, expr); return; diff --git a/src/compiler/llvm_codegen_internal.h b/src/compiler/llvm_codegen_internal.h index 751907e9c..8fa687d5a 100644 --- a/src/compiler/llvm_codegen_internal.h +++ b/src/compiler/llvm_codegen_internal.h @@ -545,6 +545,7 @@ void llvm_emit_len_for_expr(GenContext *c, BEValue *be_value, BEValue *expr_to_l LLVMValueRef llvm_get_ref(GenContext *c, Decl *decl); LLVMValueRef llvm_emit_call_intrinsic(GenContext *c, unsigned intrinsic, LLVMTypeRef *types, unsigned type_count, LLVMValueRef *values, unsigned arg_count); void llvm_emit_cast(GenContext *c, CastKind cast_kind, Expr *expr, BEValue *value, Type *to_type, Type *from_type); +void llvm_emit_bool_cast(GenContext *c, Expr *expr, BEValue *value); void llvm_emit_local_var_alloca(GenContext *c, Decl *decl); void llvm_emit_local_decl(GenContext *c, Decl *decl, BEValue *value); void llvm_emit_builtin_call(GenContext *c, BEValue *result_value, Expr *expr); diff --git a/src/compiler/llvm_codegen_stmt.c b/src/compiler/llvm_codegen_stmt.c index dabb6672d..25f1869a3 100644 --- a/src/compiler/llvm_codegen_stmt.c +++ b/src/compiler/llvm_codegen_stmt.c @@ -199,8 +199,9 @@ static void llvm_emit_cond(GenContext *c, BEValue *be_value, Expr *expr, bool bo if (bool_cast && be_value->type != type_bool) { Type *type = be_value->type; - CastKind cast = cast_to_bool_kind(type); - llvm_emit_cast(c, cast, last, be_value, type_bool, type); + llvm_emit_bool_cast(c, last, be_value); + +// llvm_emit_cast(c, cast, last, be_value, type_bool, type); } } diff --git a/src/compiler/sema_builtins.c b/src/compiler/sema_builtins.c index 5924b0375..5e911c8cc 100644 --- a/src/compiler/sema_builtins.c +++ b/src/compiler/sema_builtins.c @@ -504,8 +504,15 @@ bool sema_expr_analyse_builtin_call(SemaContext *context, Expr *expr) case BUILTIN_ANY_MAKE: ASSERT0(arg_count == 2); if (!sema_check_builtin_args(context, args, (BuiltinArg[]) {BA_POINTER, BA_TYPEID}, 2)) return false; - rtype = type_any; - break; + { + expr->expr_kind = EXPR_MAKE_ANY; + expr->make_any_expr = (ExprMakeAny) { + .inner = args[0], + .typeid = args[1] + }; + expr->type = type_add_optional(type_any, optional); + return true; + } case BUILTIN_EXACT_NEG: ASSERT0(arg_count == 1); if (!sema_check_builtin_args(context, args, (BuiltinArg[]) {BA_INTLIKE}, 1)) return false; diff --git a/src/compiler/sema_casts.c b/src/compiler/sema_casts.c index 215793d52..a67128e6c 100644 --- a/src/compiler/sema_casts.c +++ b/src/compiler/sema_casts.c @@ -333,63 +333,6 @@ static bool cast_if_valid(SemaContext *context, Expr *expr, Type *to_type, bool } - - -/** - * For implicit casts to bool, in a conditional, return the type of cast to - * insert. - */ -CastKind cast_to_bool_kind(Type *type) -{ - switch (type_flatten(type)->type_kind) - { - case FLATTENED_TYPES: - // These are not possible due to flattening. - UNREACHABLE - case TYPE_WILDCARD: - case TYPE_BOOL: - return CAST_BOOLBOOL; - case TYPE_FAULTTYPE: - case TYPE_ANYFAULT: - return CAST_EUBOOL; - case TYPE_SLICE: - return CAST_SLBOOL; - case ALL_INTS: - return CAST_INTBOOL; - case ALL_FLOATS: - return CAST_FPBOOL; - case TYPE_POINTER: - case TYPE_FUNC_PTR: - return CAST_PTRBOOL; - case TYPE_ANY: - case TYPE_INTERFACE: - return CAST_ANYBOOL; - case TYPE_BITSTRUCT: - return CAST_BSBOOL; - case TYPE_INFERRED_ARRAY: - case TYPE_INFERRED_VECTOR: - // These should never be here, type should already be known. - UNREACHABLE - case TYPE_POISONED: - case TYPE_VOID: - case TYPE_STRUCT: - case TYPE_UNION: - case TYPE_FUNC_RAW: - case TYPE_ARRAY: - case TYPE_TYPEID: - case TYPE_TYPEINFO: - case TYPE_VECTOR: - case TYPE_UNTYPED_LIST: - case TYPE_FLEXIBLE_ARRAY: - case TYPE_ENUM: - case TYPE_MEMBER: - // Everything else is an error - return CAST_ERROR; - } - UNREACHABLE -} - - /** * Check whether an expression may narrow. * 1. If it has an intrinsic type, then compare it against the type. If the bitwidth is smaller or same => ok @@ -490,10 +433,17 @@ RETRY: expr = exprptr(expr->ternary_expr.else_expr); goto RETRY; } + case EXPR_EXT_TRUNC: + if (type_size(type) >= type_size(expr->type)) + { + return NULL; + } + // Otherwise just look through it. + expr = expr->ext_trunc_expr.inner; + goto RETRY; case EXPR_CAST: switch (expr->cast_expr.kind) { - case CAST_INTINT: case CAST_FPFP: // If this is a narrowing cast that makes it smaller that then target type // we're done. @@ -1464,26 +1414,26 @@ static inline bool insert_runtime_cast(Expr *expr, CastKind kind, Type *type) } static void cast_vaptr_to_slice(SemaContext *context, Expr *expr, Type *type) { insert_runtime_cast(expr, CAST_APTSA, type); } -static void cast_ptr_to_any(SemaContext *context, Expr *expr, Type *type) { insert_runtime_cast(expr, CAST_PTRANY, type); } +static void cast_ptr_to_any(SemaContext *context, Expr *expr, Type *type) +{ + Expr *inner = expr_copy(expr); + Expr *typeid = expr_copy(expr); + expr_rewrite_const_typeid(typeid, type_no_optional(expr->type)->canonical->pointer); + expr->expr_kind = EXPR_MAKE_ANY; + expr->make_any_expr = (ExprMakeAny) { .inner = inner, .typeid = typeid }; + expr->type = type; +} static void cast_struct_to_inline(SemaContext *context, Expr *expr, Type *type) { insert_runtime_cast(expr, CAST_STINLINE, type); } static void cast_fault_to_anyfault(SemaContext *context, Expr *expr, Type *type) { expr->type = type; }; static void cast_fault_to_ptr(SemaContext *context, Expr *expr, Type *type) { insert_runtime_cast(expr, CAST_ERPTR, type); } -static void cast_typeid_to_int(SemaContext *context, Expr *expr, Type *type) -{ - expr_rewrite_ext_trunc(expr, type, type_is_signed(type_flatten(type))); -} - -static void cast_fault_to_int(SemaContext *context, Expr *expr, Type *type) -{ - cast_typeid_to_int(context, expr, type); -} +static void cast_typeid_to_int(SemaContext *context, Expr *expr, Type *type) { expr_rewrite_ext_trunc(expr, type, type_is_signed(type_flatten_to_int(type))); } +static void cast_fault_to_int(SemaContext *context, Expr *expr, Type *type) { cast_typeid_to_int(context, expr, type); } static void cast_typeid_to_ptr(SemaContext *context, Expr *expr, Type *type) { insert_runtime_cast(expr, CAST_IDPTR, type); } -static void cast_any_to_bool(SemaContext *context, Expr *expr, Type *type) { insert_runtime_cast(expr, CAST_ANYBOOL, type); } -static void cast_any_to_ptr(SemaContext *context, Expr *expr, Type *type) -{ - expr_rewrite_ptr_access(expr, type); +static void cast_any_to_bool(SemaContext *context, Expr *expr, Type *type) { + expr_rewrite_ptr_access(expr, type_voidptr); + expr_rewrite_int_to_bool(expr, false); } - +static void cast_any_to_ptr(SemaContext *context, Expr *expr, Type *type) { expr_rewrite_ptr_access(expr, type); } static void cast_all_to_void(SemaContext *context, Expr *expr, Type *to_type) { insert_runtime_cast(expr, CAST_VOID, type_void); } static void cast_retype(SemaContext *context, Expr *expr, Type *to_type) { expr->type = to_type; } @@ -1626,33 +1576,6 @@ static void cast_int_to_enum(SemaContext *context, Expr *expr, Type *type) expr->type = type; } -static inline Type *type_flatten_to_int(Type *type) -{ - while (1) - { - type = type->canonical; - switch (type->type_kind) - { - case TYPE_DISTINCT: - type = type->decl->distinct->type; - break; - case TYPE_OPTIONAL: - type = type->optional; - break; - case TYPE_BITSTRUCT: - type = type->decl->strukt.container_type->type; - break; - case TYPE_ENUM: - type = type->decl->enums.type_info->type; - break; - case TYPE_TYPEDEF: - UNREACHABLE - default: - ASSERT0(type_is_integer(type)); - return type; - } - } -} /** * Convert between integers: CAST_INTINT @@ -1669,7 +1592,11 @@ static void cast_int_to_int(SemaContext *context, Expr *expr, Type *type) } // Insert runtime casts on non-const. - if (insert_runtime_cast_unless_const(expr, CAST_INTINT, type)) return; + if (!expr_is_const(expr)) + { + expr_rewrite_ext_trunc(expr, type, type_is_signed(type_flatten_to_int(expr->type))); + return; + } Type *flat = type_flatten_to_int(type); // Hand this off to the int conversion. @@ -1843,7 +1770,7 @@ static void cast_vec_to_vec(SemaContext *context, Expr *expr, Type *to_type) insert_runtime_cast(expr, CAST_INTBOOL, to_type); return; case ALL_INTS: - insert_runtime_cast(expr, CAST_INTINT, to_type); + expr_rewrite_ext_trunc(expr, to_type, type_is_signed(type_flatten_to_int(expr->type))); return; case TYPE_POINTER: case TYPE_FUNC_PTR: @@ -1974,7 +1901,12 @@ static void cast_bool_to_float(SemaContext *context, Expr *expr, Type *type) */ static void cast_int_to_bool(SemaContext *context, Expr *expr, Type *type) { - if (insert_runtime_cast_unless_const(expr, CAST_INTBOOL, type)) return; + if (!expr_is_const(expr)) + { + expr_rewrite_int_to_bool(expr, false); + expr->type = type; + return; + } expr_rewrite_const_bool(expr, type, !int_is_zero(expr->const_expr.ixx)); } @@ -2009,7 +1941,12 @@ static void cast_ptr_to_int(SemaContext *context, Expr *expr, Type *type) */ static void cast_ptr_to_bool(SemaContext *context, Expr *expr, Type *type) { - if (insert_runtime_cast_unless_const(expr, CAST_PTRBOOL, type)) return; + if (!expr_is_const(expr)) + { + expr_rewrite_int_to_bool(expr, false); + expr->type = type; + return; + } // It may be a pointer switch (expr->const_expr.const_kind) @@ -2182,19 +2119,10 @@ static void cast_arr_to_arr(SemaContext *context, Expr *expr, Type *to_type) static void cast_anyfault_to_bool(SemaContext *context, Expr *expr, Type *to_type) { - if (insert_runtime_cast_unless_const(expr, CAST_EUBOOL, to_type)) return; - - ASSERT0(expr->const_expr.const_kind == CONST_ERR); - expr_rewrite_const_bool(expr, type_bool, expr->const_expr.enum_err_val != NULL); -} - -static void cast_typeid_to_bool(SemaContext *context, Expr *expr, Type *to_type) -{ - if (insert_runtime_cast_unless_const(expr, CAST_IDBOOL, to_type)) return; - - ASSERT0(expr->const_expr.const_kind == CONST_TYPEID); - expr_rewrite_const_bool(expr, type_bool, expr->const_expr.typeid != NULL); + expr_rewrite_int_to_bool(expr, false); + expr->type = to_type; } +static void cast_typeid_to_bool(SemaContext *context, Expr *expr, Type *to_type) { expr_rewrite_int_to_bool(expr, false); expr->type = to_type; } #define XX2XX &cast_retype #define BS2IA &cast_bitstruct_to_int_arr diff --git a/src/compiler/sema_expr.c b/src/compiler/sema_expr.c index 334d43baa..d62fdbdf6 100644 --- a/src/compiler/sema_expr.c +++ b/src/compiler/sema_expr.c @@ -446,6 +446,7 @@ static bool sema_binary_is_expr_lvalue(SemaContext *context, Expr *top_expr, Exp case EXPR_CT_IDENT: return true; case EXPR_EXT_TRUNC: + case EXPR_INT_TO_BOOL: return false; case EXPR_OTHER_CONTEXT: return sema_binary_is_expr_lvalue(context, top_expr, expr->expr_other_context.inner); @@ -570,6 +571,7 @@ static bool sema_binary_is_expr_lvalue(SemaContext *context, Expr *top_expr, Exp case EXPR_MEMBER_GET: case EXPR_NAMED_ARGUMENT: case EXPR_PTR_ACCESS: + case EXPR_MAKE_ANY: goto ERR; } UNREACHABLE @@ -598,6 +600,7 @@ static bool expr_may_ref(Expr *expr) case EXPR_MEMBER_GET: case EXPR_EXT_TRUNC: case EXPR_PTR_ACCESS: + case EXPR_INT_TO_BOOL: return false; case EXPR_OTHER_CONTEXT: return expr_may_ref(expr->expr_other_context.inner); @@ -701,6 +704,7 @@ static bool expr_may_ref(Expr *expr) case EXPR_TYPEID_INFO: case EXPR_TYPEINFO: case EXPR_VASPLAT: + case EXPR_MAKE_ANY: return false; } UNREACHABLE @@ -859,10 +863,9 @@ static inline bool sema_expr_analyse_ternary(SemaContext *context, Type *infer_t if (!sema_analyse_expr(context, cond)) return expr_poison(expr); ASSERT_SPAN(expr, cond && cond->type); Type *type = cond->type->canonical; - if (type->type_kind != TYPE_BOOL && cast_to_bool_kind(type) == CAST_ERROR) + if (type->type_kind != TYPE_BOOL && !may_cast(context, cond, type_bool, true, true)) { - SEMA_ERROR(cond, "Cannot convert expression to boolean."); - return false; + RETURN_SEMA_ERROR(cond, "Cannot convert expression to boolean."); } if (expr_is_const(cond)) { @@ -7171,24 +7174,30 @@ static inline bool sema_expr_analyse_not(SemaContext *context, Expr *expr) } } - if (cast_to_bool_kind(type_flatten(type)) == CAST_ERROR) + if (!cast_explicit_silent(context, inner, type_add_optional(type_bool, IS_OPTIONAL(inner)))) { - SEMA_ERROR(expr, "The %s can't be converted to a boolean value.", type_quoted_error_string(inner->type)); - return false; + RETURN_SEMA_ERROR(expr, "The %s can't be converted to a boolean value.", type_quoted_error_string(inner->type)); } expr->type = type_add_optional(type_bool, IS_OPTIONAL(inner)); + if (inner->expr_kind == EXPR_INT_TO_BOOL) + { + inner->int_to_bool_expr.negate = !inner->int_to_bool_expr.negate; + expr_replace(expr, inner); + return true; + } + if (sema_cast_const(inner)) { - bool success = cast_explicit(context, inner, expr->type); - ASSERT_SPAN(expr, success); ASSERT_SPAN(expr, inner->const_expr.const_kind == CONST_BOOL); expr->const_expr.const_kind = CONST_BOOL; expr->expr_kind = EXPR_CONST; expr->resolve_status = RESOLVE_DONE; expr->const_expr.b = !inner->const_expr.b; + return true; } + return true; } @@ -8940,7 +8949,9 @@ static inline bool sema_expr_analyse_ct_defined(SemaContext *context, Expr *expr case EXPR_MEMBER_GET: case EXPR_SPLAT: case EXPR_EXT_TRUNC: + case EXPR_INT_TO_BOOL: case EXPR_PTR_ACCESS: + case EXPR_MAKE_ANY: if (!sema_analyse_expr(active_context, main_expr)) return false; break; } @@ -9318,8 +9329,13 @@ static inline bool sema_analyse_expr_dispatch(SemaContext *context, Expr *expr, case EXPR_TRY_UNWRAP_CHAIN: case EXPR_TYPEID_INFO: UNREACHABLE + case EXPR_MAKE_ANY: + if (!sema_analyse_expr(context, expr->make_any_expr.typeid)) return false; + return sema_analyse_expr(context, expr->make_any_expr.inner); case EXPR_PTR_ACCESS: return sema_analyse_expr(context, expr->inner_expr); + case EXPR_INT_TO_BOOL: + return sema_analyse_expr(context, expr->int_to_bool_expr.inner); case EXPR_EXT_TRUNC: return sema_analyse_expr(context, expr->ext_trunc_expr.inner); case EXPR_SPLAT: diff --git a/src/compiler/sema_liveness.c b/src/compiler/sema_liveness.c index d7a61156f..c1918ce1b 100644 --- a/src/compiler/sema_liveness.c +++ b/src/compiler/sema_liveness.c @@ -271,6 +271,10 @@ RETRY: return; case EXPR_BUILTIN: return; + case EXPR_MAKE_ANY: + sema_trace_expr_liveness(expr->make_any_expr.typeid); + expr = expr->make_any_expr.inner; + goto RETRY; case EXPR_ACCESS: case EXPR_BITACCESS: sema_trace_decl_liveness(expr->access_expr.ref); @@ -486,6 +490,9 @@ RETRY: case EXPR_TRY_UNWRAP_CHAIN: sema_trace_expr_list_liveness(expr->try_unwrap_chain_expr); return; + case EXPR_INT_TO_BOOL: + sema_trace_expr_liveness(expr->int_to_bool_expr.inner); + return; case EXPR_EXT_TRUNC: sema_trace_expr_liveness(expr->ext_trunc_expr.inner); return; diff --git a/src/compiler/sema_stmts.c b/src/compiler/sema_stmts.c index f63d4dadf..b2e53d091 100644 --- a/src/compiler/sema_stmts.c +++ b/src/compiler/sema_stmts.c @@ -273,6 +273,29 @@ static inline bool sema_analyse_continue_stmt(SemaContext *context, Ast *stateme return true; } + +static inline Expr *sema_dive_into_expression(Expr *expr) +{ + // Dive into any cast, because it might have been cast into boolean. + while (true) + { + switch (expr->expr_kind) + { + case EXPR_MAKE_ANY: + expr = expr->make_any_expr.inner; + continue; + case EXPR_INT_TO_BOOL: + expr = expr->int_to_bool_expr.inner; + continue; + case EXPR_CAST: + expr = exprptr(expr->cast_expr.expr); + continue; + default: + return expr; + } + } + +} /** * If we have "if (catch x)", then we want to unwrap x in the else clause. **/ @@ -282,12 +305,8 @@ static void sema_unwrappable_from_catch_in_else(SemaContext *c, Expr *cond) Expr *last = VECLAST(cond->cond_expr); ASSERT0(last); + last = sema_dive_into_expression(last); - // Dive into any cast, because it might have been cast into boolean. - while (last->expr_kind == EXPR_CAST) - { - last = exprptr(last->cast_expr.expr); - } // Skip any non-unwraps if (last->expr_kind != EXPR_CATCH_UNWRAP) return; @@ -525,7 +544,7 @@ static inline bool sema_analyse_block_exit_stmt(SemaContext *context, Ast *state INLINE bool sema_check_not_stack_variable_escape(SemaContext *context, Expr *expr) { Expr *outer = expr; - while (expr->expr_kind == EXPR_CAST) expr = exprptr(expr->cast_expr.expr); + expr = sema_dive_into_expression(expr); // We only want && and & if (expr->expr_kind == EXPR_SUBSCRIPT_ADDR) { @@ -535,8 +554,7 @@ INLINE bool sema_check_not_stack_variable_escape(SemaContext *context, Expr *exp if (expr->expr_kind != EXPR_UNARY) return true; if (expr->unary_expr.operator == UNARYOP_TADDR) { - SEMA_ERROR(outer, "A pointer to a temporary value will be invalid once the function returns. Try copying the value to the heap or the temp memory instead."); - return false; + RETURN_SEMA_ERROR(outer, "A pointer to a temporary value will be invalid once the function returns. Try copying the value to the heap or the temp memory instead."); } if (expr->unary_expr.operator != UNARYOP_ADDR) return true; expr = expr->unary_expr.expr; @@ -689,6 +707,7 @@ static inline bool sema_expr_valid_try_expression(Expr *expr) case EXPR_TYPECALL: case EXPR_MEMBER_GET: case EXPR_SPLAT: + case EXPR_MAKE_ANY: return false; case EXPR_BITACCESS: case EXPR_BUILTIN: @@ -739,6 +758,7 @@ static inline bool sema_expr_valid_try_expression(Expr *expr) case EXPR_ASM: case EXPR_DEFAULT_ARG: case EXPR_EXT_TRUNC: + case EXPR_INT_TO_BOOL: case EXPR_PTR_ACCESS: return true; } @@ -1115,12 +1135,10 @@ static inline bool sema_analyse_cond(SemaContext *context, Expr *expr, CondType if (IS_OPTIONAL(init)) { return sema_error_failed_cast(context, last, last->type, cast_to_bool ? type_bool : init->type); - return false; } - if (cast_to_bool && cast_to_bool_kind(typeget(decl->var.type_info)) == CAST_ERROR) + if (cast_to_bool && !may_cast(context, init, type_bool, true, true)) { - SEMA_ERROR(last->decl_expr->var.init_expr, "The expression needs to be convertible to a boolean."); - return false; + RETURN_SEMA_ERROR(last->decl_expr->var.init_expr, "The expression needs to be convertible to a boolean."); } if (cast_to_bool && expr_is_const_bool(init)) { diff --git a/test/test_suite/assert/assertf.c3t b/test/test_suite/assert/assertf.c3t index fc2f6f43f..bcbe59204 100644 --- a/test/test_suite/assert/assertf.c3t +++ b/test/test_suite/assert/assertf.c3t @@ -20,17 +20,14 @@ entry: %indirectarg = alloca %"any[]", align 8 store i64 0, ptr %i, align 8 br label %loop.cond - loop.cond: ; preds = %assert_ok, %entry %0 = load i64, ptr %i, align 8 %gt = icmp ugt i64 100000000, %0 br i1 %gt, label %loop.body, label %loop.exit - loop.body: ; preds = %loop.cond %1 = load i64, ptr %i, align 8 %neq = icmp ne i64 2, %1 br i1 %neq, label %assert_ok, label %assert_fail - assert_fail: ; preds = %loop.body %2 = insertvalue %any undef, ptr %i, 0 %3 = insertvalue %any %2, i64 ptrtoint (ptr @"$ct.ulong" to i64), 1 @@ -47,13 +44,11 @@ assert_fail: ; preds = %loop.body store %"any[]" %"$$temp", ptr %indirectarg, align 8 call void @std.core.builtin.panicf(ptr @.panic_msg, i64 10, ptr @.file, i64 10, ptr @.func, i64 4, i32 7, ptr byval(%"any[]") align 8 %indirectarg) unreachable - assert_ok: ; preds = %loop.body %8 = load i64, ptr %i, align 8 %add = add i64 %8, 1 store i64 %add, ptr %i, align 8 br label %loop.cond - loop.exit: ; preds = %loop.cond ret i64 0 } diff --git a/test/test_suite/bitstruct/bitstruct_bool.c3t b/test/test_suite/bitstruct/bitstruct_bool.c3t index 0ef74af7a..ea8d46b8d 100644 --- a/test/test_suite/bitstruct/bitstruct_bool.c3t +++ b/test/test_suite/bitstruct/bitstruct_bool.c3t @@ -56,8 +56,9 @@ if.exit: ; preds = %entry %6 = load i8, ptr %ptradd, align 1 %zext2 = zext i8 %6 to i32 %7 = add i32 %zext, %zext2 - %8 = icmp eq i32 %7, 0 - br i1 %8, label %if.then3, label %if.exit4 + %8 = icmp ne i32 %7, 0 + %not = xor i1 %8, true + br i1 %not, label %if.then3, label %if.exit4 if.then3: ; preds = %if.exit ret void diff --git a/test/test_suite/clang/2002-01_02.c3t b/test/test_suite/clang/2002-01_02.c3t index 754ce90f8..af1fc4528 100644 --- a/test/test_suite/clang/2002-01_02.c3t +++ b/test/test_suite/clang/2002-01_02.c3t @@ -169,8 +169,8 @@ declare void @foo2(i32, double, float) #0 ; Function Attrs: define void @test.bar(i32 %0) #0 { entry: - %intbool = icmp ne i32 %0, 0 - %ternary = select i1 %intbool, double 1.000000e+00, double 1.250000e+01 + %i2b = icmp ne i32 %0, 0 + %ternary = select i1 %i2b, double 1.000000e+00, double 1.250000e+01 call void @foo2(i32 %0, double %ternary, float 1.000000e+00) ret void } @@ -223,8 +223,8 @@ entry: loop.body: ; preds = %if.exit, %entry %2 = load i32, ptr %lvalid, align 4 - %not = icmp eq i32 %2, 0 - br i1 %not, label %if.then, label %if.exit + %i2nb = icmp eq i32 %2, 0 + br i1 %i2nb, label %if.then, label %if.exit if.then: ; preds = %loop.body %3 = load ptr, ptr %basel, align 8 diff --git a/test/test_suite/clang/2002-03.c3t b/test/test_suite/clang/2002-03.c3t index e0a4166c1..ab572335a 100644 --- a/test/test_suite/clang/2002-03.c3t +++ b/test/test_suite/clang/2002-03.c3t @@ -79,8 +79,8 @@ entry: store i32 0, ptr %asa, align 4 store double 0.000000e+00, ptr %val, align 8 store i32 0, ptr %lLS, align 4 - %intbool = icmp ne i32 %1, 0 - br i1 %intbool, label %if.then, label %if.exit + %i2b = icmp ne i32 %1, 0 + br i1 %i2b, label %if.then, label %if.exit if.then: ; preds = %entry %2 = load i32, ptr %lLS, align 4 %3 = load i32, ptr %asa, align 4 diff --git a/test/test_suite/clang/2002-04.c3t b/test/test_suite/clang/2002-04.c3t index c66fdb82d..864a3264d 100644 --- a/test/test_suite/clang/2002-04.c3t +++ b/test/test_suite/clang/2002-04.c3t @@ -75,8 +75,8 @@ entry: loop.cond: ; preds = %switch.exit, %entry %0 = call i32 @foo() - %intbool = icmp ne i32 %0, 0 - br i1 %intbool, label %loop.body, label %loop.exit + %i2b = icmp ne i32 %0, 0 + br i1 %i2b, label %loop.body, label %loop.exit loop.body: ; preds = %loop.cond %1 = call i32 @foo() diff --git a/test/test_suite/clang/2002-07.c3t b/test/test_suite/clang/2002-07.c3t index c55709e94..aaa9c6097 100644 --- a/test/test_suite/clang/2002-07.c3t +++ b/test/test_suite/clang/2002-07.c3t @@ -300,7 +300,6 @@ fn int strcmp(char *s1, char *s2) { %Quad = type { i32, %SubStruct, ptr, i8, i32 } %SubStruct = type { i16, i16 } %PBVTest = type { double, double, i32 } - @"$ct.foo.List" = linkonce global %.introspect { i8 10, i64 0, ptr null, i64 16, i64 0, i64 2, [0 x i64] zeroinitializer }, align 8 @"$ct.foo.PBVTest" = linkonce global %.introspect { i8 10, i64 0, ptr null, i64 24, i64 0, i64 3, [0 x i64] zeroinitializer }, align 8 @"$ct.foo.FunStructTest" = linkonce global %.introspect { i8 10, i64 0, ptr null, i64 64, i64 0, i64 3, [0 x i64] zeroinitializer }, align 8 @@ -346,20 +345,17 @@ entry: %l = alloca ptr, align 8 store ptr %0, ptr %l, align 8 br label %loop.cond - loop.cond: ; preds = %loop.body, %entry %2 = load ptr, ptr %l, align 8 %3 = load ptr, ptr %2, align 8 - %ptrbool = icmp ne ptr %3, null - br i1 %ptrbool, label %loop.body, label %loop.exit - + %i2b = icmp ne ptr %3, null + br i1 %i2b, label %loop.body, label %loop.exit loop.body: ; preds = %loop.cond %4 = load ptr, ptr %l, align 8 %5 = load ptr, ptr %4, align 8 %ptradd = getelementptr inbounds i8, ptr %5, i64 8 store ptr %ptradd, ptr %l, align 8 br label %loop.cond - loop.exit: ; preds = %loop.cond %6 = load ptr, ptr %l, align 8 %7 = call ptr @malloc(i32 16) @@ -377,20 +373,16 @@ loop.exit: ; preds = %loop.cond ; Function Attrs: define ptr @foo.findData(ptr %0, i32 %1) #0 { entry: - %not = icmp eq ptr %0, null - br i1 %not, label %if.then, label %if.exit - + %i2nb = icmp eq ptr %0, null + br i1 %i2nb, label %if.then, label %if.exit if.then: ; preds = %entry ret ptr null - if.exit: ; preds = %entry %2 = load i32, ptr %0, align 8 %eq = icmp eq i32 %2, %1 br i1 %eq, label %if.then1, label %if.exit2 - if.then1: ; preds = %if.exit ret ptr %0 - if.exit2: ; preds = %if.exit %ptradd = getelementptr inbounds i8, ptr %0, i64 8 %3 = load ptr, ptr %ptradd, align 8 @@ -413,33 +405,27 @@ entry: call void @foo.insertIntoListTail(ptr %myList, i32 1213) %0 = load ptr, ptr %myList, align 8 %1 = call ptr @foo.findData(ptr %0, i32 75) - %ptrbool = icmp ne ptr %1, null - br i1 %ptrbool, label %if.then, label %if.exit - + %i2b = icmp ne ptr %1, null + br i1 %i2b, label %if.then, label %if.exit if.then: ; preds = %entry call void @foundIt() br label %if.exit - if.exit: ; preds = %if.then, %entry %2 = load ptr, ptr %myList, align 8 %3 = call ptr @foo.findData(ptr %2, i32 42) - %ptrbool1 = icmp ne ptr %3, null - br i1 %ptrbool1, label %if.then2, label %if.exit3 - + %i2b1 = icmp ne ptr %3, null + br i1 %i2b1, label %if.then2, label %if.exit3 if.then2: ; preds = %if.exit call void @foundIt() br label %if.exit3 - if.exit3: ; preds = %if.then2, %if.exit %4 = load ptr, ptr %myList, align 8 %5 = call ptr @foo.findData(ptr %4, i32 700) - %ptrbool4 = icmp ne ptr %5, null - br i1 %ptrbool4, label %if.then5, label %if.exit6 - + %i2b4 = icmp ne ptr %5, null + br i1 %i2b4, label %if.then5, label %if.exit6 if.then5: ; preds = %if.exit3 call void @foundIt() br label %if.exit6 - if.exit6: ; preds = %if.then5, %if.exit3 ret void } @@ -451,13 +437,11 @@ entry: %5 = load double, ptr %1, align 8 %lt = fcmp olt double %4, %5 br i1 %lt, label %or.phi, label %or.rhs - or.rhs: ; preds = %entry %6 = load float, ptr %2, align 4 %7 = load float, ptr %3, align 4 %lt1 = fcmp olt float %6, %7 br label %or.phi - or.phi: ; preds = %or.rhs, %entry %val = phi i1 [ true, %entry ], [ %lt1, %or.rhs ] %zext = zext i1 %val to i32 @@ -478,7 +462,6 @@ loop.cond: ; preds = %loop.body, %entry %smod = srem i64 %3, 4 %neq = icmp ne i64 %smod, 0 br i1 %neq, label %loop.body, label %loop.exit - loop.body: ; preds = %loop.cond %4 = load i64, ptr %dstp, align 8 %intptr = inttoptr i64 %4 to ptr @@ -503,14 +486,12 @@ entry: %1 = load i32, ptr @foo.remaining, align 4 %gt = icmp sgt i32 %0, %1 br i1 %gt, label %if.then, label %if.exit - if.then: ; preds = %entry %2 = call ptr @malloc(i32 32768) store ptr %2, ptr @foo.temp, align 8 store i32 32768, ptr @foo.remaining, align 4 %3 = load ptr, ptr @foo.temp, align 8 ret ptr %3 - if.exit: ; preds = %entry ret ptr null } @@ -553,8 +534,8 @@ declare i32 @fp(i32, ptr) #0 define void @foo.__bb_exit_func() #0 { entry: %0 = load ptr, ptr @foo.ext, align 8 - %ptrbool = icmp ne ptr %0, null - br i1 %ptrbool, label %cond.lhs, label %cond.rhs + %i2b = icmp ne ptr %0, null + br i1 %i2b, label %cond.lhs, label %cond.rhs cond.lhs: ; preds = %entry %1 = load ptr, ptr @foo.ext, align 8 br label %cond.phi @@ -612,8 +593,8 @@ entry: define internal i32 @foo.f0(ptr byval(%Quad) align 8 %0, i32 %1) #0 { entry: %r = alloca %Quad, align 8 - %intbool = icmp ne i32 %1, 0 - br i1 %intbool, label %if.then, label %if.exit + %i2b = icmp ne i32 %1, 0 + br i1 %i2b, label %if.then, label %if.exit if.then: ; preds = %entry %ptradd = getelementptr inbounds i8, ptr %r, i64 4 %ptradd1 = getelementptr inbounds i8, ptr %0, i64 4 @@ -647,8 +628,8 @@ if.exit: ; preds = %if.then, %entry define i32 @foo.f1(ptr %0, i32 %1) #0 { entry: %r = alloca %Quad, align 8 - %intbool = icmp ne i32 %1, 0 - br i1 %intbool, label %if.then, label %if.exit + %i2b = icmp ne i32 %1, 0 + br i1 %i2b, label %if.then, label %if.exit if.then: ; preds = %entry call void @llvm.memcpy.p0.p0.i32(ptr align 8 %r, ptr align 8 %0, i32 24, i1 false) br label %if.exit @@ -904,8 +885,8 @@ loop.cond: ; preds = %loop.body, %entry store ptr %ptradd_any1, ptr %s2, align 8 %4 = load i8, ptr %3, align 1 store i8 %4, ptr %2, align 1 - %intbool = icmp ne i8 %4, 0 - br i1 %intbool, label %loop.body, label %loop.exit + %i2b = icmp ne i8 %4, 0 + br i1 %i2b, label %loop.body, label %loop.exit loop.body: ; preds = %loop.cond br label %loop.cond loop.exit: ; preds = %loop.cond @@ -925,8 +906,8 @@ loop.cond: ; preds = %loop.body, %entry %ptradd_any = getelementptr i8, ptr %2, i8 1 store ptr %ptradd_any, ptr %s1, align 8 %3 = load i8, ptr %2, align 1 - %intbool = icmp ne i8 %3, 0 - br i1 %intbool, label %loop.body, label %loop.exit + %i2b = icmp ne i8 %3, 0 + br i1 %i2b, label %loop.body, label %loop.exit loop.body: ; preds = %loop.cond br label %loop.cond loop.exit: ; preds = %loop.cond @@ -943,8 +924,8 @@ loop.cond2: ; preds = %loop.body6, %loop.e store ptr %ptradd_any4, ptr %s2, align 8 %7 = load i8, ptr %6, align 1 store i8 %7, ptr %5, align 1 - %intbool5 = icmp ne i8 %7, 0 - br i1 %intbool5, label %loop.body6, label %loop.exit7 + %i2b5 = icmp ne i8 %7, 0 + br i1 %i2b5, label %loop.body6, label %loop.exit7 loop.body6: ; preds = %loop.cond2 br label %loop.cond2 loop.exit7: ; preds = %loop.cond2 diff --git a/test/test_suite/debug_symbols/defer_macro.c3t b/test/test_suite/debug_symbols/defer_macro.c3t index c5ffc2a31..589c9050a 100644 --- a/test/test_suite/debug_symbols/defer_macro.c3t +++ b/test/test_suite/debug_symbols/defer_macro.c3t @@ -253,17 +253,13 @@ entry: %not_err = icmp eq i64 %12, 0, !dbg !101 %13 = call i1 @llvm.expect.i1(i1 %not_err, i1 true), !dbg !101 br i1 %13, label %after_check, label %assign_optional, !dbg !101 - assign_optional: ; preds = %entry store i64 %12, ptr %error_var, align 8, !dbg !101 br label %guard_block, !dbg !101 - after_check: ; preds = %entry br label %noerr_block, !dbg !101 - guard_block: ; preds = %assign_optional br label %voiderr, !dbg !101 - noerr_block: ; preds = %after_check %14 = load i64, ptr %retparam, align 8, !dbg !101 store i64 %14, ptr %len, align 8, !dbg !101 @@ -272,39 +268,30 @@ noerr_block: ; preds = %after_check %not_err6 = icmp eq i64 %16, 0, !dbg !103 %17 = call i1 @llvm.expect.i1(i1 %not_err6, i1 true), !dbg !103 br i1 %17, label %after_check8, label %assign_optional7, !dbg !103 - assign_optional7: ; preds = %noerr_block store i64 %16, ptr %error_var5, align 8, !dbg !103 br label %guard_block9, !dbg !103 - after_check8: ; preds = %noerr_block br label %noerr_block10, !dbg !103 - guard_block9: ; preds = %assign_optional7 br label %voiderr, !dbg !103 - noerr_block10: ; preds = %after_check8 %18 = load ptr, ptr %out, align 8, !dbg !104 %19 = call i64 @std.io.File.flush(ptr %18), !dbg !104 %not_err12 = icmp eq i64 %19, 0, !dbg !104 %20 = call i1 @llvm.expect.i1(i1 %not_err12, i1 true), !dbg !104 br i1 %20, label %after_check14, label %assign_optional13, !dbg !104 - assign_optional13: ; preds = %noerr_block10 store i64 %19, ptr %error_var11, align 8, !dbg !104 br label %guard_block15, !dbg !104 - after_check14: ; preds = %noerr_block10 br label %noerr_block16, !dbg !104 - guard_block15: ; preds = %assign_optional13 br label %voiderr, !dbg !104 - noerr_block16: ; preds = %after_check14 %21 = load i64, ptr %len, align 8, !dbg !105 %add = add i64 %21, 1, !dbg !105 br label %voiderr, !dbg !96 - voiderr: ; preds = %noerr_block16, %guard_block15, %guard_block9, %guard_block ret ptr null, !dbg !106 } @@ -397,13 +384,11 @@ entry: %mul = mul i64 16, %9, !dbg !159 store i64 %mul, ptr %size, align 8 %10 = load i64, ptr %size, align 8, !dbg !160 - %not = icmp eq i64 %10, 0, !dbg !160 - br i1 %not, label %if.then, label %if.exit, !dbg !160 - + %i2nb = icmp eq i64 %10, 0, !dbg !160 + br i1 %i2nb, label %if.then, label %if.exit, !dbg !160 if.then: ; preds = %entry store ptr null, ptr %blockret11, align 8, !dbg !163 br label %expr_block.exit, !dbg !163 - if.exit: ; preds = %entry %ptradd = getelementptr inbounds i8, ptr %allocator10, i64 8, !dbg !164 %11 = load i64, ptr %ptradd, align 8, !dbg !164 @@ -411,7 +396,6 @@ if.exit: ; preds = %entry %type = load ptr, ptr %.cachedtype, align 8 %13 = icmp eq ptr %12, %type br i1 %13, label %cache_hit, label %cache_miss - cache_miss: ; preds = %if.exit %ptradd12 = getelementptr inbounds i8, ptr %12, i64 16 %14 = load ptr, ptr %ptradd12, align 8 @@ -419,21 +403,17 @@ cache_miss: ; preds = %if.exit store ptr %15, ptr %.inlinecache, align 8 store ptr %12, ptr %.cachedtype, align 8 br label %16 - cache_hit: ; preds = %if.exit %cache_hit_fn = load ptr, ptr %.inlinecache, align 8 br label %16 - 16: ; preds = %cache_hit, %cache_miss %fn_phi = phi ptr [ %cache_hit_fn, %cache_hit ], [ %15, %cache_miss ] %17 = icmp eq ptr %fn_phi, null br i1 %17, label %missing_function, label %match - missing_function: ; preds = %16 %18 = load ptr, ptr @std.core.builtin.panic, align 8, !dbg !166 call void %18(ptr @.panic_msg, i64 44, ptr @.file, i64 16, ptr @.func, i64 6, i32 68), !dbg !166 unreachable, !dbg !166 - match: ; preds = %16 %19 = load ptr, ptr %allocator10, align 8 %20 = load i64, ptr %size, align 8 @@ -441,16 +421,13 @@ match: ; preds = %16 %not_err = icmp eq i64 %21, 0, !dbg !166 %22 = call i1 @llvm.expect.i1(i1 %not_err, i1 true), !dbg !166 br i1 %22, label %after_check, label %assign_optional, !dbg !166 - assign_optional: ; preds = %match store i64 %21, ptr %error_var, align 8, !dbg !166 br label %panic_block, !dbg !166 - after_check: ; preds = %match %23 = load ptr, ptr %retparam, align 8, !dbg !166 store ptr %23, ptr %blockret11, align 8, !dbg !166 br label %expr_block.exit, !dbg !166 - expr_block.exit: ; preds = %after_check, %if.then %24 = load ptr, ptr %blockret11, align 8, !dbg !166 store ptr %24, ptr %taddr, align 8 @@ -461,7 +438,6 @@ expr_block.exit: ; preds = %after_check, %if.th %27 = insertvalue %"char[][]" undef, ptr %25, 0, !dbg !167 %28 = insertvalue %"char[][]" %27, i64 %size13, 1, !dbg !167 br label %noerr_block, !dbg !167 - panic_block: ; preds = %assign_optional %29 = insertvalue %any undef, ptr %error_var, 0, !dbg !167 %30 = insertvalue %any %29, i64 ptrtoint (ptr @"$ct.anyfault" to i64), 1, !dbg !167 @@ -471,19 +447,16 @@ panic_block: ; preds = %assign_optional store %"any[]" %"$$temp", ptr %indirectarg, align 8 call void @std.core.builtin.panicf(ptr @.panic_msg.1 unreachable, !dbg !154 - noerr_block: ; preds = %expr_block.exit store %"char[][]" %28, ptr %list5, align 8, !dbg !154 !170 store i32 0, ptr %i, align 4, !dbg !171 br label %loop.cond, !dbg !171 - loop.cond: ; preds = %loop.exit, %noerr_block %32 = load i32, ptr %i, align 4, !dbg !172 %33 = load i32, ptr %argc2, align 4, !dbg !173 %lt = icmp slt i32 %32, %33, !dbg !172 br i1 %lt, label %loop.body, label %loop.exit26, !dbg !172 - loop.body: ; preds = %loop.cond !176 %34 = load ptr, ptr %argv3, align 8, !dbg !177 @@ -504,21 +477,18 @@ loop.body: ; preds = %loop.cond !187 store i64 0, ptr %len18, align 8, !dbg !189 br label %loop.cond19, !dbg !190 - loop.cond19: ; preds = %loop.body21, %loop.body %41 = load ptr, ptr %ptr, align 8, !dbg !191 %42 = load i64, ptr %len18, align 8, !dbg !193 %ptradd20 = getelementptr inbounds i8, ptr %41, i64 %42, !dbg !193 %43 = load i8, ptr %ptradd20, align 1, !dbg !193 - %intbool = icmp ne i8 %43, 0, !dbg !193 - br i1 %intbool, label %loop.body21, label %loop.exit, !dbg !193 - + %i2b = icmp ne i8 %43, 0, !dbg !193 + br i1 %i2b, label %loop.body21, label %loop.exit, !dbg !193 loop.body21: ; preds = %loop.cond19 %44 = load i64, ptr %len18, align 8, !dbg !194 %add22 = add i64 %44, 1, !dbg !194 store i64 %add22, ptr %len18, align 8, !dbg !194 br label %loop.cond19, !dbg !194 - loop.exit: ; preds = %loop.cond19 %45 = load i64, ptr %len18, align 8, !dbg !195 %add23 = add i64 0, %45, !dbg !195 @@ -530,7 +500,6 @@ loop.exit: ; preds = %loop.cond19 %add25 = add i32 %48, 1, !dbg !196 store i32 %add25, ptr %i, align 4, !dbg !196 br label %loop.cond, !dbg !196 - loop.exit26: ; preds = %loop.cond call void @llvm.memcpy.p0.p0.i32(ptr align 8 %list, ptr align 8 %list5, i32 16, i1 false), !dbg !197 %lo = load ptr, ptr %list, align 8, !dbg !198 @@ -541,7 +510,6 @@ loop.exit26: ; preds = %loop.cond %50 = load ptr, ptr %list, align 8, !dbg !200 call void @std.core.mem.free(ptr %50) br label %expr_block.exit28, !dbg !202 - expr_block.exit28: ; preds = %loop.exit26 %51 = load i32, ptr %blockret, align 4, !dbg !202 ret i32 %51, !dbg !202 @@ -562,29 +530,23 @@ declare extern_weak i64 @std.io.File.flush(ptr) #0 declare { ptr, i64 } @arena_scratch_begin(ptr, i64) #0 declare void @arena_scratch_end(ptr, i64) #0 - define weak ptr @.dyn_search(ptr %0, ptr %1) unnamed_addr { entry: br label %check - check: ; preds = %no_match, %entry %2 = phi ptr [ %0, %entry ], [ %9, %no_match ] %3 = icmp eq ptr %2, null br i1 %3, label %missing_function, label %compare - missing_function: ; preds = %check ret ptr null - compare: ; preds = %check %4 = getelementptr inbounds %5 = load ptr, ptr %4, align 8 %6 = icmp eq ptr %5, %1 br i1 %6, label %match, label %no_match - match: ; preds = %compare %7 = load ptr, ptr %2, align 8 ret ptr %7 - no_match: ; preds = %compare %8 = getelementptr inbounds %9 = load ptr, ptr %8, align 8 @@ -592,7 +554,6 @@ no_match: ; preds = %compare } !llvm.dbg.cu = !{!6} - !0 = !{i32 2, !"Dwarf Version", i32 4} !1 = !{i32 2, !"Debug Info Version", i32 3} !2 = !{i32 2, !"wchar_size", i32 4} diff --git a/test/test_suite/defer/defer_catch_mix.c3t b/test/test_suite/defer/defer_catch_mix.c3t index 9b7d27c86..ba7fe7395 100644 --- a/test/test_suite/defer/defer_catch_mix.c3t +++ b/test/test_suite/defer/defer_catch_mix.c3t @@ -370,8 +370,8 @@ after_check: ; preds = %testblock br label %end_block end_block: ; preds = %after_check, %assign_optional %4 = load i64, ptr %temp_err, align 8 - %neq = icmp ne i64 %4, 0 - br i1 %neq, label %if.then, label %if.exit + %i2b = icmp ne i64 %4, 0 + br i1 %i2b, label %if.then, label %if.exit if.then: ; preds = %end_block store i32 1, ptr %blockret, align 4 br label %expr_block.exit diff --git a/test/test_suite/defer/defer_with_catch.c3t b/test/test_suite/defer/defer_with_catch.c3t index e48b18aec..88ed0c416 100644 --- a/test/test_suite/defer/defer_with_catch.c3t +++ b/test/test_suite/defer/defer_with_catch.c3t @@ -21,86 +21,68 @@ entry: %0 = load i32, ptr %a, align 4 %gt = icmp sgt i32 %0, 0 br i1 %gt, label %if.then, label %if.exit - if.then: ; preds = %entry br label %testblock - testblock: ; preds = %if.then %1 = call i64 @test.test() %not_err = icmp eq i64 %1, 0 %2 = call i1 @llvm.expect.i1(i1 %not_err, i1 true) br i1 %2, label %after_check, label %assign_optional - assign_optional: ; preds = %testblock store i64 %1, ptr %b, align 8 br label %end_block - after_check: ; preds = %testblock store i64 0, ptr %b, align 8 br label %end_block - end_block: ; preds = %after_check, %assign_optional %3 = load i64, ptr %b, align 8 - %neq = icmp ne i64 %3, 0 + %i2b = icmp ne i64 %3, 0 br label %testblock1 - testblock1: ; preds = %end_block %4 = call i64 @test.test() %not_err2 = icmp eq i64 %4, 0 %5 = call i1 @llvm.expect.i1(i1 %not_err2, i1 true) br i1 %5, label %after_check4, label %assign_optional3 - assign_optional3: ; preds = %testblock1 store i64 %4, ptr %e, align 8 br label %end_block5 - after_check4: ; preds = %testblock1 store i64 0, ptr %e, align 8 br label %end_block5 - end_block5: ; preds = %after_check4, %assign_optional3 %6 = load i64, ptr %e, align 8 - %neq6 = icmp ne i64 %6, 0 + %i2b6 = icmp ne i64 %6, 0 ret void - if.exit: ; preds = %entry br label %testblock8 - testblock8: ; preds = %if.exit %7 = call i64 @test.test() %not_err9 = icmp eq i64 %7, 0 %8 = call i1 @llvm.expect.i1(i1 %not_err9, i1 true) br i1 %8, label %after_check11, label %assign_optional10 - assign_optional10: ; preds = %testblock8 store i64 %7, ptr %b7, align 8 br label %end_block12 - after_check11: ; preds = %testblock8 store i64 0, ptr %b7, align 8 br label %end_block12 - end_block12: ; preds = %after_check11, %assign_optional10 %9 = load i64, ptr %b7, align 8 - %neq13 = icmp ne i64 %9, 0 + %i2b13 = icmp ne i64 %9, 0 br label %testblock15 - testblock15: ; preds = %end_block12 %10 = call i64 @test.test() %not_err16 = icmp eq i64 %10, 0 %11 = call i1 @llvm.expect.i1(i1 %not_err16, i1 true) br i1 %11, label %after_check18, label %assign_optional17 - assign_optional17: ; preds = %testblock15 store i64 %10, ptr %e14, align 8 br label %end_block19 - after_check18: ; preds = %testblock15 store i64 0, ptr %e14, align 8 br label %end_block19 - end_block19: ; preds = %after_check18, %assign_optional17 %12 = load i64, ptr %e14, align 8 - %neq20 = icmp ne i64 %12, 0 + %i2b20 = icmp ne i64 %12, 0 ret void } diff --git a/test/test_suite/errors/anyfault_void.c3t b/test/test_suite/errors/anyfault_void.c3t index 92a898c8c..0925f1b23 100644 --- a/test/test_suite/errors/anyfault_void.c3t +++ b/test/test_suite/errors/anyfault_void.c3t @@ -60,8 +60,8 @@ after_check: ; preds = %testblock br label %end_block end_block: ; preds = %after_check, %assign_optional %2 = load i64, ptr %f, align 8 - %neq = icmp ne i64 %2, 0 - br i1 %neq, label %if.then, label %if.exit + %i2b = icmp ne i64 %2, 0 + br i1 %i2b, label %if.then, label %if.exit if.then: ; preds = %end_block %3 = load i64, ptr %f, align 8 store i64 %3, ptr %blockret, align 8 @@ -90,8 +90,8 @@ after_check6: ; preds = %testblock3 br label %end_block7 end_block7: ; preds = %after_check6, %assign_optional5 %8 = load i64, ptr %f2, align 8 - %neq8 = icmp ne i64 %8, 0 - br i1 %neq8, label %if.then9, label %if.exit10 + %i2b8 = icmp ne i64 %8, 0 + br i1 %i2b8, label %if.then9, label %if.exit10 if.then9: ; preds = %end_block7 %9 = load i64, ptr %f2, align 8 store i64 %9, ptr %blockret1, align 8 diff --git a/test/test_suite/errors/error_regression_2.c3t b/test/test_suite/errors/error_regression_2.c3t index 766d4ea9d..2e97e2b96 100644 --- a/test/test_suite/errors/error_regression_2.c3t +++ b/test/test_suite/errors/error_regression_2.c3t @@ -154,8 +154,8 @@ define void @test.Summary.print(ptr %0, ptr %1) #0 { entry: %title = alloca %"char[]", align 8 %2 = load ptr, ptr %0, align 8 - %ptrbool = icmp ne ptr %2, null - br i1 %ptrbool, label %cond.lhs, label %cond.rhs + %i2b = icmp ne ptr %2, null + br i1 %i2b, label %cond.lhs, label %cond.rhs cond.lhs: ; preds = %entry %3 = load ptr, ptr %0, align 8 @@ -210,8 +210,8 @@ if.then: ; preds = %entry if.exit: ; preds = %entry %8 = load i64, ptr %needle_len, align 8 - %not = icmp eq i64 %8, 0 - br i1 %not, label %if.then4, label %if.exit5 + %i2nb = icmp eq i64 %8, 0 + br i1 %i2nb, label %if.then4, label %if.exit5 if.then4: ; preds = %if.exit ret i8 1 @@ -326,8 +326,8 @@ if.then10: ; preds = %if.exit6 %9 = call ptr @std.core.mem.malloc(i64 8) #3 store ptr %9, ptr %temp, align 8 %10 = load ptr, ptr %temp, align 8 - %not = icmp eq ptr %10, null - br i1 %not, label %if.then14, label %if.exit15 + %i2nb = icmp eq ptr %10, null + br i1 %i2nb, label %if.then14, label %if.exit15 if.then14: ; preds = %if.then10 store i64 ptrtoint (ptr @"test.ReadError$OUT_OF_MEMORY" to i64), ptr %error_var, align 8 @@ -362,8 +362,8 @@ if.then20: ; preds = %if.exit16 %16 = call ptr @std.core.mem.malloc(i64 16) #3 store ptr %16, ptr %temp27, align 8 %17 = load ptr, ptr %temp27, align 8 - %not28 = icmp eq ptr %17, null - br i1 %not28, label %if.then29, label %if.exit30 + %i2nb28 = icmp eq ptr %17, null + br i1 %i2nb28, label %if.then29, label %if.exit30 if.then29: ; preds = %if.then20 store i64 ptrtoint (ptr @"test.ReadError$OUT_OF_MEMORY" to i64), ptr %error_var25, align 8 @@ -385,8 +385,8 @@ noerr_block32: ; preds = %if.exit30 %21 = call ptr @std.core.mem.malloc(i64 8) #3 store ptr %21, ptr %temp34, align 8 %22 = load ptr, ptr %temp34, align 8 - %not35 = icmp eq ptr %22, null - br i1 %not35, label %if.then36, label %if.exit37 + %i2nb35 = icmp eq ptr %22, null + br i1 %i2nb35, label %if.then36, label %if.exit37 if.then36: ; preds = %noerr_block32 store i64 ptrtoint (ptr @"test.ReadError$OUT_OF_MEMORY" to i64), ptr %error_var23, align 8 @@ -420,8 +420,8 @@ if.exit40: ; preds = %if.exit16 %30 = call ptr @std.core.mem.malloc(i64 %add) #3 store ptr %30, ptr %str, align 8 %31 = load ptr, ptr %str, align 8 - %not42 = icmp eq ptr %31, null - br i1 %not42, label %if.then43, label %if.exit44 + %i2nb42 = icmp eq ptr %31, null + br i1 %i2nb42, label %if.then43, label %if.exit44 if.then43: ; preds = %if.exit40 ret i64 ptrtoint (ptr @"test.ReadError$OUT_OF_MEMORY" to i64) @@ -447,8 +447,8 @@ if.exit44: ; preds = %if.exit40 %42 = call ptr @std.core.mem.malloc(i64 16) #3 store ptr %42, ptr %temp54, align 8 %43 = load ptr, ptr %temp54, align 8 - %not55 = icmp eq ptr %43, null - br i1 %not55, label %if.then56, label %if.exit57 + %i2nb55 = icmp eq ptr %43, null + br i1 %i2nb55, label %if.then56, label %if.exit57 if.then56: ; preds = %if.exit44 store i64 ptrtoint (ptr @"test.ReadError$OUT_OF_MEMORY" to i64), ptr %error_var52, align 8 @@ -470,8 +470,8 @@ noerr_block59: ; preds = %if.exit57 %47 = call ptr @std.core.mem.malloc(i64 8) #3 store ptr %47, ptr %temp61, align 8 %48 = load ptr, ptr %temp61, align 8 - %not62 = icmp eq ptr %48, null - br i1 %not62, label %if.then63, label %if.exit64 + %i2nb62 = icmp eq ptr %48, null + br i1 %i2nb62, label %if.then63, label %if.exit64 if.then63: ; preds = %noerr_block59 store i64 ptrtoint (ptr @"test.ReadError$OUT_OF_MEMORY" to i64), ptr %error_var50, align 8 @@ -503,8 +503,8 @@ entry: %ptradd = getelementptr inbounds i8, ptr %literal, i64 8 store i8 0, ptr %ptradd, align 8 %1 = load ptr, ptr %doc, align 8 - %ptrbool = icmp ne ptr %1, null - br i1 %ptrbool, label %cond.lhs, label %cond.rhs + %i2b = icmp ne ptr %1, null + br i1 %i2b, label %cond.lhs, label %cond.rhs cond.lhs: ; preds = %entry %2 = load ptr, ptr %doc, align 8 @@ -565,8 +565,8 @@ entry: %reterr = alloca i64, align 8 store ptr %1, ptr %doc, align 8 %2 = load ptr, ptr %doc, align 8 - %not = icmp eq ptr %2, null - br i1 %not, label %if.then, label %if.exit + %i2nb = icmp eq ptr %2, null + br i1 %i2nb, label %if.then, label %if.exit if.then: ; preds = %entry ret i64 ptrtoint (ptr @"test.TitleResult$TITLE_MISSING" to i64) @@ -576,8 +576,8 @@ if.exit: ; preds = %entry %4 = load ptr, ptr %3, align 8 store ptr %4, ptr %head, align 8 %5 = load ptr, ptr %head, align 8 - %not1 = icmp eq ptr %5, null - br i1 %not1, label %if.then2, label %if.exit3 + %i2nb1 = icmp eq ptr %5, null + br i1 %i2nb1, label %if.then2, label %if.exit3 if.then2: ; preds = %if.exit ret i64 ptrtoint (ptr @"test.TitleResult$TITLE_MISSING" to i64) @@ -698,7 +698,7 @@ entry: store i64 0, ptr %.anon1, align 8 br label %loop.cond -loop.cond: ; preds = %phi_block19, %entry +loop.cond: %1 = load i64, ptr %.anon1, align 8 %2 = load i64, ptr %.anon, align 8 %lt = icmp ult i64 %1, %2 @@ -725,8 +725,8 @@ loop.body: ; preds = %loop.cond call void @test.Summary.print(ptr %summary, ptr %10) %11 = call i32 (ptr, ...) @printf(ptr @.str.23) %12 = load ptr, ptr %summary, align 8 - %ptrbool = icmp ne ptr %12, null - br i1 %ptrbool, label %cond.lhs, label %cond.rhs + %i2b = icmp ne ptr %12, null + br i1 %i2b, label %cond.lhs, label %cond.rhs cond.lhs: ; preds = %loop.body %13 = load ptr, ptr %summary, align 8 @@ -792,8 +792,8 @@ after_check13: ; preds = %testblock end_block: ; preds = %after_check13, %assign_optional12 %25 = load i64, ptr %f, align 8 - %neq = icmp ne i64 %25, 0 - br i1 %neq, label %if.then, label %if.exit + %i2b14 = icmp ne i64 %25, 0 + br i1 %i2b14, label %if.then, label %if.exit if.then: ; preds = %end_block %26 = load i64, ptr %f, align 8 @@ -810,24 +810,24 @@ expr_block.exit: ; preds = %if.exit, %if.then br label %phi_block phi_block: ; preds = %expr_block.exit, %after_check9 - %val14 = phi ptr [ %23, %after_check9 ], [ %28, %expr_block.exit ] - %optval15 = load i64, ptr %has_title.f, align 8 - %not_err16 = icmp eq i64 %optval15, 0 - %29 = call i1 @llvm.expect.i1(i1 %not_err16, i1 true) - br i1 %29, label %after_check17, label %else_block18 + %val15 = phi ptr [ %23, %after_check9 ], [ %28, %expr_block.exit ] + %optval16 = load i64, ptr %has_title.f, align 8 + %not_err17 = icmp eq i64 %optval16, 0 + %29 = call i1 @llvm.expect.i1(i1 %not_err17, i1 true) + br i1 %29, label %after_check18, label %else_block19 -after_check17: ; preds = %phi_block +after_check18: ; preds = %phi_block %30 = load i8, ptr %has_title, align 1 %31 = trunc i8 %30 to i1 - br label %phi_block19 + br label %phi_block20 -else_block18: ; preds = %phi_block - br label %phi_block19 +else_block19: ; preds = %phi_block + br label %phi_block20 -phi_block19: ; preds = %else_block18, %after_check17 - %val20 = phi i1 [ %31, %after_check17 ], [ false, %else_block18 ] - %ternary = select i1 %val20, ptr @.str.26, ptr @.str.27 - %32 = call i32 (ptr, ...) @printf(ptr @.str.25, ptr %val14, ptr %ternary) +phi_block20: ; preds = %else_block19, %after_check18 + %val21 = phi i1 [ %31, %after_check18 ], [ false, %else_block19 ] + %ternary = select i1 %val21, ptr @.str.26, ptr @.str.27 + %32 = call i32 (ptr, ...) @printf(ptr @.str.25, ptr %val15, ptr %ternary) %33 = load i64, ptr %.anon1, align 8 %addnuw = add nuw i64 %33, 1 store i64 %addnuw, ptr %.anon1, align 8 diff --git a/test/test_suite/errors/failable_catch.c3t b/test/test_suite/errors/failable_catch.c3t index 8412ff5e2..b8b827ad3 100644 --- a/test/test_suite/errors/failable_catch.c3t +++ b/test/test_suite/errors/failable_catch.c3t @@ -70,8 +70,8 @@ else_block: ; preds = %after_assign phi_block: ; preds = %else_block, %after_check %val = phi i32 [ %add, %after_check ], [ 2, %else_block ] - %intbool = icmp ne i32 %val, 0 - br i1 %intbool, label %if.then2, label %if.exit + %i2b = icmp ne i32 %val, 0 + br i1 %i2b, label %if.then2, label %if.exit if.then2: ; preds = %phi_block store i32 %val, ptr %blockret1, align 4 @@ -146,40 +146,40 @@ after_check22: ; preds = %testblock end_block: ; preds = %after_check22, %assign_optional %11 = load i64, ptr %f, align 8 - %neq = icmp ne i64 %11, 0 - br i1 %neq, label %if.then23, label %if.exit24 + %i2b23 = icmp ne i64 %11, 0 + br i1 %i2b23, label %if.then24, label %if.exit25 -if.then23: ; preds = %end_block +if.then24: ; preds = %end_block %12 = load i64, ptr %f, align 8 store i64 %12, ptr %blockret19, align 8 - br label %expr_block.exit25 + br label %expr_block.exit26 -if.exit24: ; preds = %end_block +if.exit25: ; preds = %end_block store i64 0, ptr %blockret19, align 8 - br label %expr_block.exit25 + br label %expr_block.exit26 -expr_block.exit25: ; preds = %if.exit24, %if.then23 +expr_block.exit26: ; preds = %if.exit25, %if.then24 %13 = load i64, ptr %blockret19, align 8 - %neq26 = icmp ne i64 %13, 0 - br i1 %neq26, label %if.then27, label %if.exit28 + %i2b27 = icmp ne i64 %13, 0 + br i1 %i2b27, label %if.then28, label %if.exit29 -if.then27: ; preds = %expr_block.exit25 +if.then28: ; preds = %expr_block.exit26 call void (ptr, ...) @printf(ptr @.str.3) - br label %if.exit28 + br label %if.exit29 -if.exit28: ; preds = %if.then27, %expr_block.exit25 +if.exit29: ; preds = %if.then28, %expr_block.exit26 store i32 3, ptr %c, align 4 store i64 0, ptr %c.f, align 8 - %optval29 = load i64, ptr %c.f, align 8 - %not_err30 = icmp eq i64 %optval29, 0 - %14 = call i1 @llvm.expect.i1(i1 %not_err30, i1 true) - br i1 %14, label %after_check31, label %voiderr32 + %optval30 = load i64, ptr %c.f, align 8 + %not_err31 = icmp eq i64 %optval30, 0 + %14 = call i1 @llvm.expect.i1(i1 %not_err31, i1 true) + br i1 %14, label %after_check32, label %voiderr33 -after_check31: ; preds = %if.exit28 +after_check32: ; preds = %if.exit29 %15 = load i32, ptr %c, align 4 call void (ptr, ...) @printf(ptr @.str.4, i32 %15) - br label %voiderr32 + br label %voiderr33 -voiderr32: ; preds = %after_check31, %if.exit28 +voiderr33: ; preds = %after_check32, %if.exit29 ret i32 0 } diff --git a/test/test_suite/errors/fault_conv.c3t b/test/test_suite/errors/fault_conv.c3t index e0d4dfac0..e900b0aec 100644 --- a/test/test_suite/errors/fault_conv.c3t +++ b/test/test_suite/errors/fault_conv.c3t @@ -109,8 +109,8 @@ after_check: ; preds = %testblock end_block: ; preds = %after_check, %assign_optional %4 = load i64, ptr %err, align 8 - %neq = icmp ne i64 %4, 0 - br i1 %neq, label %if.then, label %if.exit + %i2b = icmp ne i64 %4, 0 + br i1 %i2b, label %if.then, label %if.exit if.then: ; preds = %end_block %5 = load i64, ptr %err, align 8 diff --git a/test/test_suite/errors/multiple_catch.c3t b/test/test_suite/errors/multiple_catch.c3t index 76112c830..2be69c69d 100644 --- a/test/test_suite/errors/multiple_catch.c3t +++ b/test/test_suite/errors/multiple_catch.c3t @@ -94,8 +94,8 @@ after_check4: ; preds = %testblock1 end_block: ; preds = %after_check4, %assign_optional3, %assign_optional %4 = load i64, ptr %err, align 8 - %neq = icmp ne i64 %4, 0 - br i1 %neq, label %if.then, label %if.exit + %i2b = icmp ne i64 %4, 0 + br i1 %i2b, label %if.then, label %if.exit if.then: ; preds = %end_block %5 = insertvalue %any undef, ptr %err, 0 @@ -136,8 +136,8 @@ after_check17: ; preds = %testblock14 end_block18: ; preds = %after_check17, %assign_optional16, %assign_optional12 %12 = load i64, ptr %err8, align 8 - %neq19 = icmp ne i64 %12, 0 - br i1 %neq19, label %if.then20, label %if.exit25 + %i2b19 = icmp ne i64 %12, 0 + br i1 %i2b19, label %if.then20, label %if.exit25 if.then20: ; preds = %end_block18 %13 = insertvalue %any undef, ptr %err8, 0 @@ -178,8 +178,8 @@ after_check34: ; preds = %testblock31 end_block35: ; preds = %after_check34, %assign_optional33, %assign_optional29 %20 = load i64, ptr %temp_err, align 8 - %neq36 = icmp ne i64 %20, 0 - br i1 %neq36, label %if.then37, label %if.exit55 + %i2b36 = icmp ne i64 %20, 0 + br i1 %i2b36, label %if.then37, label %if.exit55 if.then37: ; preds = %end_block35 %21 = call ptr @std.io.stdout() @@ -272,8 +272,8 @@ after_check65: ; preds = %testblock62 end_block66: ; preds = %after_check65, %assign_optional64, %assign_optional60 %34 = load i64, ptr %err56, align 8 - %neq67 = icmp ne i64 %34, 0 - br i1 %neq67, label %if.then68, label %if.exit73 + %i2b67 = icmp ne i64 %34, 0 + br i1 %i2b67, label %if.then68, label %if.exit73 if.then68: ; preds = %end_block66 %35 = insertvalue %any undef, ptr %err56, 0 diff --git a/test/test_suite/errors/optional_chained_init.c3t b/test/test_suite/errors/optional_chained_init.c3t index 16ba6d881..beec02d17 100644 --- a/test/test_suite/errors/optional_chained_init.c3t +++ b/test/test_suite/errors/optional_chained_init.c3t @@ -87,8 +87,8 @@ after_check: ; preds = %testblock end_block: ; preds = %after_check, %assign_optional %1 = load i64, ptr %err, align 8 - %neq = icmp ne i64 %1, 0 - br i1 %neq, label %if.then, label %if.exit + %i2b = icmp ne i64 %1, 0 + br i1 %i2b, label %if.then, label %if.exit if.then: ; preds = %end_block %2 = insertvalue %any undef, ptr %err, 0 @@ -116,8 +116,8 @@ after_check8: ; preds = %testblock4 end_block9: ; preds = %after_check8, %assign_optional7 %6 = load i64, ptr %err3, align 8 - %neq10 = icmp ne i64 %6, 0 - br i1 %neq10, label %if.then11, label %if.exit16 + %i2b10 = icmp ne i64 %6, 0 + br i1 %i2b10, label %if.then11, label %if.exit16 if.then11: ; preds = %end_block9 %7 = insertvalue %any undef, ptr %err3, 0 @@ -226,8 +226,8 @@ after_check5: ; preds = %testblock end_block: ; preds = %after_check5, %assign_optional4 %3 = load i64, ptr %err, align 8 - %neq = icmp ne i64 %3, 0 - br i1 %neq, label %if.then, label %if.exit + %i2b = icmp ne i64 %3, 0 + br i1 %i2b, label %if.then, label %if.exit if.then: ; preds = %end_block %4 = insertvalue %any undef, ptr %err, 0 @@ -255,8 +255,8 @@ after_check13: ; preds = %testblock9 end_block14: ; preds = %after_check13, %assign_optional12 %8 = load i64, ptr %err8, align 8 - %neq15 = icmp ne i64 %8, 0 - br i1 %neq15, label %if.then16, label %if.exit21 + %i2b15 = icmp ne i64 %8, 0 + br i1 %i2b15, label %if.then16, label %if.exit21 if.then16: ; preds = %end_block14 %9 = insertvalue %any undef, ptr %err8, 0 @@ -366,8 +366,8 @@ after_check5: ; preds = %testblock end_block: ; preds = %after_check5, %assign_optional4 %3 = load i64, ptr %err, align 8 - %neq = icmp ne i64 %3, 0 - br i1 %neq, label %if.then, label %if.exit + %i2b = icmp ne i64 %3, 0 + br i1 %i2b, label %if.then, label %if.exit if.then: ; preds = %end_block %4 = insertvalue %any undef, ptr %err, 0 @@ -395,8 +395,8 @@ after_check13: ; preds = %testblock9 end_block14: ; preds = %after_check13, %assign_optional12 %8 = load i64, ptr %err8, align 8 - %neq15 = icmp ne i64 %8, 0 - br i1 %neq15, label %if.then16, label %if.exit21 + %i2b15 = icmp ne i64 %8, 0 + br i1 %i2b15, label %if.then16, label %if.exit21 if.then16: ; preds = %end_block14 %9 = insertvalue %any undef, ptr %err8, 0 diff --git a/test/test_suite/errors/optional_with_optional.c3t b/test/test_suite/errors/optional_with_optional.c3t index bc1d5626b..94e32b413 100644 --- a/test/test_suite/errors/optional_with_optional.c3t +++ b/test/test_suite/errors/optional_with_optional.c3t @@ -176,8 +176,8 @@ testblock: ; preds = %phi_block38 end_block: ; preds = %testblock %27 = load i64, ptr %f, align 8 - %neq = icmp ne i64 %27, 0 - br i1 %neq, label %if.then, label %if.exit + %i2b = icmp ne i64 %27, 0 + br i1 %i2b, label %if.then, label %if.exit if.then: ; preds = %end_block %28 = load i64, ptr %f, align 8 @@ -206,8 +206,8 @@ testblock56: ; preds = %expr_block.exit end_block57: ; preds = %testblock56 %35 = load i64, ptr %f55, align 8 - %neq58 = icmp ne i64 %35, 0 - br i1 %neq58, label %if.then59, label %if.exit60 + %i2b58 = icmp ne i64 %35, 0 + br i1 %i2b58, label %if.then59, label %if.exit60 if.then59: ; preds = %end_block57 %36 = load i64, ptr %f55, align 8 @@ -234,8 +234,8 @@ phi_block70: ; preds = %testblock68 end_block71: ; preds = %phi_block70 %40 = load i64, ptr %f67, align 8 - %neq72 = icmp ne i64 %40, 0 - br i1 %neq72, label %if.then73, label %if.exit74 + %i2b72 = icmp ne i64 %40, 0 + br i1 %i2b72, label %if.then73, label %if.exit74 if.then73: ; preds = %end_block71 %41 = load i64, ptr %f67, align 8 @@ -265,8 +265,8 @@ define i64 @test.get_a(ptr %0, i32 %1) #0 { entry: %reterr = alloca i64, align 8 %smod = srem i32 %1, 2 - %intbool = icmp ne i32 %smod, 0 - br i1 %intbool, label %if.then, label %if.exit + %i2b = icmp ne i32 %smod, 0 + br i1 %i2b, label %if.then, label %if.exit if.then: ; preds = %entry ret i64 ptrtoint (ptr @"test.Foo$ABC" to i64) diff --git a/test/test_suite/errors/or_and_rethrow.c3t b/test/test_suite/errors/or_and_rethrow.c3t index f2eec0004..4f055f771 100644 --- a/test/test_suite/errors/or_and_rethrow.c3t +++ b/test/test_suite/errors/or_and_rethrow.c3t @@ -63,8 +63,8 @@ entry: %2 = insertvalue %any %1, i64 ptrtoint (ptr @"$ct.int" to i64), 1 store %any %2, ptr %varargslots, align 16 %3 = call i64 @std.io.printfn(ptr %retparam, ptr @.str.1, i64 8, ptr %varargslots, i64 1) - %intbool = icmp ne i32 %0, 0 - br i1 %intbool, label %or.phi, label %or.rhs + %i2b = icmp ne i32 %0, 0 + br i1 %i2b, label %or.phi, label %or.rhs or.rhs: ; preds = %entry store i64 ptrtoint (ptr @"foo.Foo$ABC" to i64), ptr %error_var, align 8 @@ -229,8 +229,8 @@ entry: %2 = insertvalue %any %1, i64 ptrtoint (ptr @"$ct.int" to i64), 1 store %any %2, ptr %varargslots, align 16 %3 = call i64 @std.io.printfn(ptr %retparam, ptr @.str.6, i64 9, ptr %varargslots, i64 1) - %intbool = icmp ne i32 %0, 0 - br i1 %intbool, label %and.rhs, label %and.phi + %i2b = icmp ne i32 %0, 0 + br i1 %i2b, label %and.rhs, label %and.phi and.rhs: ; preds = %entry store i64 ptrtoint (ptr @"foo.Foo$ABC" to i64), ptr %error_var, align 8 @@ -349,8 +349,8 @@ after_check: ; preds = %testblock end_block: ; preds = %after_check, %assign_optional %2 = load i64, ptr %f, align 8 - %neq = icmp ne i64 %2, 0 - br i1 %neq, label %if.then, label %if.exit + %i2b = icmp ne i64 %2, 0 + br i1 %i2b, label %if.then, label %if.exit if.then: ; preds = %end_block %3 = load i64, ptr %f, align 8 @@ -382,8 +382,8 @@ after_check6: ; preds = %testblock3 end_block7: ; preds = %after_check6, %assign_optional5 %7 = load i64, ptr %f2, align 8 - %neq8 = icmp ne i64 %7, 0 - br i1 %neq8, label %if.then9, label %if.exit10 + %i2b8 = icmp ne i64 %7, 0 + br i1 %i2b8, label %if.then9, label %if.exit10 if.then9: ; preds = %end_block7 %8 = load i64, ptr %f2, align 8 @@ -415,8 +415,8 @@ after_check17: ; preds = %testblock14 end_block18: ; preds = %after_check17, %assign_optional16 %12 = load i64, ptr %f13, align 8 - %neq19 = icmp ne i64 %12, 0 - br i1 %neq19, label %if.then20, label %if.exit21 + %i2b19 = icmp ne i64 %12, 0 + br i1 %i2b19, label %if.then20, label %if.exit21 if.then20: ; preds = %end_block18 %13 = load i64, ptr %f13, align 8 @@ -448,8 +448,8 @@ after_check28: ; preds = %testblock25 end_block29: ; preds = %after_check28, %assign_optional27 %17 = load i64, ptr %f24, align 8 - %neq30 = icmp ne i64 %17, 0 - br i1 %neq30, label %if.then31, label %if.exit32 + %i2b30 = icmp ne i64 %17, 0 + br i1 %i2b30, label %if.then31, label %if.exit32 if.then31: ; preds = %end_block29 %18 = load i64, ptr %f24, align 8 diff --git a/test/test_suite/errors/ternary_void_fault.c3t b/test/test_suite/errors/ternary_void_fault.c3t index df5d82daa..d8a279213 100644 --- a/test/test_suite/errors/ternary_void_fault.c3t +++ b/test/test_suite/errors/ternary_void_fault.c3t @@ -54,8 +54,8 @@ cond.phi: ; preds = %after_check3, %afte end_block: ; preds = %cond.phi, %assign_optional2, %assign_optional %5 = load i64, ptr %f, align 8 - %neq = icmp ne i64 %5, 0 - br i1 %neq, label %if.then, label %if.exit + %i2b = icmp ne i64 %5, 0 + br i1 %i2b, label %if.then, label %if.exit if.then: ; preds = %end_block %6 = load i64, ptr %f, align 8 diff --git a/test/test_suite/errors/try_assign.c3t b/test/test_suite/errors/try_assign.c3t index 98654f962..eafbee252 100644 --- a/test/test_suite/errors/try_assign.c3t +++ b/test/test_suite/errors/try_assign.c3t @@ -141,8 +141,8 @@ after_check22: ; preds = %testblock end_block: ; preds = %after_check22, %assign_optional %13 = load i64, ptr %e, align 8 - %neq = icmp ne i64 %13, 0 - br i1 %neq, label %if.then23, label %if.exit24 + %i2b = icmp ne i64 %13, 0 + br i1 %i2b, label %if.then23, label %if.exit24 if.then23: ; preds = %end_block %14 = call i32 (ptr, ...) @printf(ptr @.str.2) diff --git a/test/test_suite/errors/try_catch_if.c3t b/test/test_suite/errors/try_catch_if.c3t index 6ab3b2086..10479e060 100644 --- a/test/test_suite/errors/try_catch_if.c3t +++ b/test/test_suite/errors/try_catch_if.c3t @@ -84,8 +84,8 @@ after_check4: ; preds = %testblock1 end_block: ; preds = %after_check4, %assign_optional3, %assign_optional %3 = load i64, ptr %err, align 8 - %neq = icmp ne i64 %3, 0 - br i1 %neq, label %if.then, label %if.else + %i2b = icmp ne i64 %3, 0 + br i1 %i2b, label %if.then, label %if.else if.then: ; preds = %end_block %4 = call i32 (ptr, ...) @printf(ptr @.str.1) diff --git a/test/test_suite/errors/try_with_unwrapper.c3t b/test/test_suite/errors/try_with_unwrapper.c3t index b28b106c8..bdc5f79da 100644 --- a/test/test_suite/errors/try_with_unwrapper.c3t +++ b/test/test_suite/errors/try_with_unwrapper.c3t @@ -160,8 +160,8 @@ phi_try_catch: ; preds = %catch_landing, %aft chain_next: ; preds = %phi_try_catch %2 = load i32, ptr %b, align 4 %3 = call i32 @try_with_unwrapper.hello(i32 %2) - %intbool = icmp ne i32 %3, 0 - br i1 %intbool, label %chain_next1, label %fail_chain + %i2b = icmp ne i32 %3, 0 + br i1 %i2b, label %chain_next1, label %fail_chain chain_next1: ; preds = %chain_next br label %end_chain diff --git a/test/test_suite/expressions/2002-02-13-ConditionalInCall.c3t b/test/test_suite/expressions/2002-02-13-ConditionalInCall.c3t index e922e42b5..ddb947ff9 100644 --- a/test/test_suite/expressions/2002-02-13-ConditionalInCall.c3t +++ b/test/test_suite/expressions/2002-02-13-ConditionalInCall.c3t @@ -11,6 +11,6 @@ fn void bar(int x) /* #expect: test.ll - %intbool = icmp ne i32 %0, 0 - %ternary = select i1 %intbool, double 1.000000e+00, double 1.250000e+01 + %i2b = icmp ne i32 %0, 0 + %ternary = select i1 %i2b, double 1.000000e+00, double 1.250000e+01 call void @foo(i32 %0, double %ternary, float 1.000000e+00) diff --git a/test/test_suite/expressions/bool_conversions.c3t b/test/test_suite/expressions/bool_conversions.c3t index 7f76b887f..e25f402c4 100644 --- a/test/test_suite/expressions/bool_conversions.c3t +++ b/test/test_suite/expressions/bool_conversions.c3t @@ -12,8 +12,8 @@ fn bool f1() { return (bool){| Test x @noinit; return x = (Test)0; |}; } define internal zeroext i8 @bool_conversions.f0_0(ptr %0) #0 { entry: - %ptrbool = icmp ne ptr %0, null - %1 = zext i1 %ptrbool to i8 + %i2b = icmp ne ptr %0, null + %1 = zext i1 %i2b to i8 ret i8 %1 } diff --git a/test/test_suite/expressions/chained_ternary.c3t b/test/test_suite/expressions/chained_ternary.c3t index 2c41a1fcc..28bf22952 100644 --- a/test/test_suite/expressions/chained_ternary.c3t +++ b/test/test_suite/expressions/chained_ternary.c3t @@ -21,8 +21,8 @@ fn void test() /* #expect: test.ll %0 = load ptr, ptr %a, align 8 - %not = icmp eq ptr %0, null - br i1 %not, label %cond.lhs, label %cond.rhs + %i2nb = icmp eq ptr %0, null + br i1 %i2nb, label %cond.lhs, label %cond.rhs cond.lhs: ; preds = %entry %1 = load ptr, ptr %a, align 8 @@ -30,8 +30,8 @@ cond.lhs: ; preds = %entry cond.rhs: ; preds = %entry %2 = load ptr, ptr %a, align 8 - %not1 = icmp eq ptr %2, null - br i1 %not1, label %cond.lhs2, label %cond.rhs3 + %i2nb1 = icmp eq ptr %2, null + br i1 %i2nb1, label %cond.lhs2, label %cond.rhs3 cond.lhs2: ; preds = %cond.rhs %3 = load ptr, ptr %b, align 8 @@ -51,8 +51,8 @@ cond.phi4: ; preds = %cond.phi, %cond.lhs store i64 0, ptr %x.f, align 8 store ptr null, ptr %x, align 8 %5 = load ptr, ptr %a, align 8 - %not6 = icmp eq ptr %5, null - br i1 %not6, label %cond.lhs7, label %cond.rhs8 + %i2nb6 = icmp eq ptr %5, null + br i1 %i2nb6, label %cond.lhs7, label %cond.rhs8 cond.lhs7: ; preds = %cond.phi4 %optval = load i64, ptr %x.f, align 8 @@ -80,8 +80,8 @@ cond.phi9: ; preds = %cond.rhs8, %after_c after_assign: ; preds = %cond.phi9, %assign_optional %9 = load ptr, ptr %a, align 8 - %not11 = icmp eq ptr %9, null - br i1 %not11, label %cond.lhs12, label %cond.rhs13 + %i2nb11 = icmp eq ptr %9, null + br i1 %i2nb11, label %cond.lhs12, label %cond.rhs13 cond.lhs12: ; preds = %after_assign %10 = load ptr, ptr %b, align 8 @@ -109,8 +109,8 @@ cond.phi18: ; preds = %after_check17, %con after_assign20: ; preds = %cond.phi18, %assign_optional16 %13 = load ptr, ptr %a, align 8 - %not21 = icmp eq ptr %13, null - br i1 %not21, label %cond.lhs22, label %cond.rhs27 + %i2nb21 = icmp eq ptr %13, null + br i1 %i2nb21, label %cond.lhs22, label %cond.rhs27 cond.lhs22: ; preds = %after_assign20 %optval23 = load i64, ptr %x.f, align 8 @@ -148,8 +148,8 @@ cond.phi32: ; preds = %after_check31, %aft after_assign34: ; preds = %cond.phi32, %assign_optional30, %assign_optional25 %18 = load ptr, ptr %a, align 8 - %not35 = icmp eq ptr %18, null - br i1 %not35, label %cond.lhs36, label %cond.rhs41 + %i2nb35 = icmp eq ptr %18, null + br i1 %i2nb35, label %cond.lhs36, label %cond.rhs41 cond.lhs36: ; preds = %after_assign34 %optval37 = load i64, ptr %x.f, align 8 @@ -176,8 +176,8 @@ cond.phi42: ; preds = %after_check40 after_assign43: ; preds = %cond.phi42, %cond.rhs41, %assign_optional39 %21 = load ptr, ptr %a, align 8 - %not44 = icmp eq ptr %21, null - br i1 %not44, label %cond.lhs45, label %cond.rhs46 + %i2nb44 = icmp eq ptr %21, null + br i1 %i2nb44, label %cond.lhs45, label %cond.rhs46 cond.lhs45: ; preds = %after_assign43 store i64 ptrtoint (ptr @"test.Test$FOO" to i64), ptr %y.f, align 8 @@ -204,8 +204,8 @@ cond.phi51: ; preds = %after_check50 after_assign52: ; preds = %cond.phi51, %assign_optional49, %cond.lhs45 %24 = load ptr, ptr %a, align 8 - %not53 = icmp eq ptr %24, null - br i1 %not53, label %cond.lhs54, label %cond.rhs55 + %i2nb53 = icmp eq ptr %24, null + br i1 %i2nb53, label %cond.lhs54, label %cond.rhs55 cond.lhs54: ; preds = %after_assign52 store i64 ptrtoint (ptr @"test.Test$FOO" to i64), ptr %y.f, align 8 diff --git a/test/test_suite/expressions/folding_ptr.c3t b/test/test_suite/expressions/folding_ptr.c3t index 53eea9f62..579b99b65 100644 --- a/test/test_suite/expressions/folding_ptr.c3t +++ b/test/test_suite/expressions/folding_ptr.c3t @@ -19,8 +19,8 @@ fn int f() define i32 @test.f() #0 { entry: %0 = load ptr, ptr @cfun, align 8 - %not = icmp eq ptr %0, null - br i1 %not, label %if.then, label %if.exit + %i2nb = icmp eq ptr %0, null + br i1 %i2nb, label %if.then, label %if.exit if.then: ; preds = %entry ret i32 0 diff --git a/test/test_suite/expressions/incdec_overload.c3t b/test/test_suite/expressions/incdec_overload.c3t index 9486556e3..9a4e5bf8a 100644 --- a/test/test_suite/expressions/incdec_overload.c3t +++ b/test/test_suite/expressions/incdec_overload.c3t @@ -218,8 +218,8 @@ after_check: ; preds = %testblock end_block: ; preds = %after_check, %assign_optional %4 = load i64, ptr %temp_err, align 8 - %neq = icmp ne i64 %4, 0 - br i1 %neq, label %if.then, label %if.exit + %i2b = icmp ne i64 %4, 0 + br i1 %i2b, label %if.then, label %if.exit if.then: ; preds = %end_block store i32 1, ptr %blockret, align 4 diff --git a/test/test_suite/expressions/optional_ternary.c3t b/test/test_suite/expressions/optional_ternary.c3t index 77e4011c8..f29a7876b 100644 --- a/test/test_suite/expressions/optional_ternary.c3t +++ b/test/test_suite/expressions/optional_ternary.c3t @@ -81,8 +81,8 @@ target triple = "x86_64-apple define i64 @test.test(i32* %0, i32 %1) #0 { entry: %reterr = alloca i64, align 8 - %intbool = icmp ne i32 %1, 0 - br i1 %intbool, label %cond.phi, label %cond.rhs + %i2b = icmp ne i32 %1, 0 + br i1 %i2b, label %cond.phi, label %cond.rhs cond.rhs: ; preds = %entry store i64 ptrtoint (%.fault* @"test.Foo$X" to i64), i64* %reterr, align 8 @@ -101,8 +101,8 @@ err_retblock: ; preds = %cond.rhs define i64 @test.test2(i32* %0, i32 %1) #0 { entry: %reterr = alloca i64, align 8 - %intbool = icmp ne i32 %1, 0 - br i1 %intbool, label %cond.lhs, label %cond.rhs + %i2b = icmp ne i32 %1, 0 + br i1 %i2b, label %cond.lhs, label %cond.rhs cond.lhs: ; preds = %entry store i64 ptrtoint (%.fault* @"test.Foo$X" to i64), i64* %reterr, align 8 @@ -125,8 +125,8 @@ err_retblock: ; preds = %cond.rhs, %cond.lhs define i64 @test.test3(i32* %0, i32 %1) #0 { entry: %reterr = alloca i64, align 8 - %intbool = icmp ne i32 %1, 0 - br i1 %intbool, label %cond.lhs, label %cond.rhs + %i2b = icmp ne i32 %1, 0 + br i1 %i2b, label %cond.lhs, label %cond.rhs cond.lhs: ; preds = %entry br label %cond.phi @@ -170,8 +170,8 @@ guard_block: ; preds = %assign_optional noerr_block: ; preds = %after_check %3 = load i32, i32* %y, align 4 - %intbool = icmp ne i32 %3, 0 - br i1 %intbool, label %cond.phi, label %cond.rhs + %i2b = icmp ne i32 %3, 0 + br i1 %i2b, label %cond.phi, label %cond.rhs cond.rhs: ; preds = %noerr_block store i64 ptrtoint (%.fault* @"test.Foo$X" to i64), i64* %reterr, align 8 @@ -212,8 +212,8 @@ guard_block: ; preds = %assign_optional noerr_block: ; preds = %after_check %3 = load i32, i32* %y, align 4 - %intbool = icmp ne i32 %3, 0 - br i1 %intbool, label %cond.lhs, label %cond.rhs + %i2b = icmp ne i32 %3, 0 + br i1 %i2b, label %cond.lhs, label %cond.rhs cond.lhs: ; preds = %noerr_block store i64 ptrtoint (%.fault* @"test.Foo$X" to i64), i64* %reterr, align 8 @@ -258,8 +258,8 @@ guard_block: ; preds = %assign_optional noerr_block: ; preds = %after_check %3 = load i32, i32* %y, align 4 - %intbool = icmp ne i32 %3, 0 - br i1 %intbool, label %cond.lhs, label %cond.rhs + %i2b = icmp ne i32 %3, 0 + br i1 %i2b, label %cond.lhs, label %cond.rhs cond.lhs: ; preds = %noerr_block br label %cond.phi @@ -303,8 +303,8 @@ guard_block: ; preds = %assign_optional noerr_block: ; preds = %after_check %3 = load i32, i32* %y, align 4 - %intbool = icmp ne i32 %3, 0 - br i1 %intbool, label %cond.lhs, label %cond.rhs + %i2b = icmp ne i32 %3, 0 + br i1 %i2b, label %cond.lhs, label %cond.rhs cond.lhs: ; preds = %noerr_block store i64 ptrtoint (%.fault* @"test.Foo$X" to i64), i64* %reterr, align 8 diff --git a/test/test_suite/functions/assorted_tests.c3t b/test/test_suite/functions/assorted_tests.c3t index f78c89c99..8abef35f5 100644 --- a/test/test_suite/functions/assorted_tests.c3t +++ b/test/test_suite/functions/assorted_tests.c3t @@ -69,8 +69,8 @@ entry: ; Function Attrs: define void @test.foo2(i32 %0) #0 { entry: - %intbool = icmp ne i32 %0, 0 - %ternary = select i1 %intbool, double 1.000000e+00, double 1.250000e+01 + %i2b = icmp ne i32 %0, 0 + %ternary = select i1 %i2b, double 1.000000e+00, double 1.250000e+01 call void @test2(i32 %0, double %ternary, float 1.000000e+00) ret void } @@ -81,8 +81,8 @@ entry: %asa = alloca i32, align 4 %val = alloca double, align 8 %lls = alloca i32, align 4 - %intbool = icmp ne i32 %1, 0 - br i1 %intbool, label %if.then, label %if.exit + %i2b = icmp ne i32 %1, 0 + br i1 %i2b, label %if.then, label %if.exit if.then: ; preds = %entry %2 = load i32, ptr %lls, align 4 diff --git a/test/test_suite/generic/generic_lambda_complex.c3t b/test/test_suite/generic/generic_lambda_complex.c3t index 385fb44c2..cb9239391 100644 --- a/test/test_suite/generic/generic_lambda_complex.c3t +++ b/test/test_suite/generic/generic_lambda_complex.c3t @@ -182,8 +182,8 @@ entry: store %"char[]" { ptr @.str, i64 21 }, ptr %foo_tmpl, align 8 call void @llvm.memset.p0.i64(ptr align 8 %ft, i8 0, i64 72, i1 false) %0 = load ptr, ptr @std.core.mem.allocator.thread_temp_allocator, align 8 - %not = icmp eq ptr %0, null - br i1 %not, label %if.then, label %if.exit + %i2nb = icmp eq ptr %0, null + br i1 %i2nb, label %if.then, label %if.exit if.then: ; preds = %entry call void @std.core.mem.allocator.init_default_temp_allocators() diff --git a/test/test_suite/macros/macro_body_defer.c3t b/test/test_suite/macros/macro_body_defer.c3t index d7e900d1e..e20d0e336 100644 --- a/test/test_suite/macros/macro_body_defer.c3t +++ b/test/test_suite/macros/macro_body_defer.c3t @@ -108,8 +108,8 @@ after_check: ; preds = %testblock end_block: ; preds = %after_check, %assign_optional %4 = load i64, ptr %temp_err, align 8 - %neq = icmp ne i64 %4, 0 - br i1 %neq, label %if.then, label %if.exit + %i2b = icmp ne i64 %4, 0 + br i1 %i2b, label %if.then, label %if.exit if.then: ; preds = %end_block store i32 1, ptr %blockret, align 4 diff --git a/test/test_suite/macros/unifying_implicit_void.c3t b/test/test_suite/macros/unifying_implicit_void.c3t index 3eb38e246..319c69343 100644 --- a/test/test_suite/macros/unifying_implicit_void.c3t +++ b/test/test_suite/macros/unifying_implicit_void.c3t @@ -92,8 +92,8 @@ after_check4: ; preds = %testblock br label %end_block end_block: ; preds = %after_check4, %assign_optional3 %15 = load i64, ptr %err, align 8 - %neq = icmp ne i64 %15, 0 - br i1 %neq, label %if.then, label %if.exit + %i2b = icmp ne i64 %15, 0 + br i1 %i2b, label %if.then, label %if.exit if.then: ; preds = %end_block %16 = load i64, ptr %err, align 8 store i64 %16, ptr %error_var, align 8 diff --git a/test/test_suite/statements/defer_break.c3t b/test/test_suite/statements/defer_break.c3t index 19f166d84..b14d5ff4b 100644 --- a/test/test_suite/statements/defer_break.c3t +++ b/test/test_suite/statements/defer_break.c3t @@ -68,8 +68,8 @@ loop.exit: ; preds = %if.exit, %if.then loop.cond: ; preds = %if.exit3, %loop.exit %3 = load i32, ptr %a, align 4 - %intbool = icmp ne i32 %3, 0 - br i1 %intbool, label %loop.body, label %loop.exit4 + %i2b = icmp ne i32 %3, 0 + br i1 %i2b, label %loop.body, label %loop.exit4 loop.body: ; preds = %loop.cond %eq1 = icmp eq i32 %0, 1 @@ -90,8 +90,8 @@ loop.exit4: ; preds = %if.then2, %loop.con loop.cond5: ; preds = %loop.exit4 %4 = load i32, ptr %a, align 4 - %intbool6 = icmp ne i32 %4, 0 - br i1 %intbool6, label %loop.body7, label %loop.exit11 + %i2b6 = icmp ne i32 %4, 0 + br i1 %i2b6, label %loop.body7, label %loop.exit11 loop.body7: ; preds = %loop.cond5 %eq8 = icmp eq i32 %0, 1 diff --git a/test/test_suite/statements/defer_break_simple.c3t b/test/test_suite/statements/defer_break_simple.c3t index d87e809a4..de8c5c2fc 100644 --- a/test/test_suite/statements/defer_break_simple.c3t +++ b/test/test_suite/statements/defer_break_simple.c3t @@ -33,8 +33,8 @@ entry: loop.cond: ; preds = %if.exit, %entry %2 = load i32, ptr %a, align 4 - %intbool = icmp ne i32 %2, 0 - br i1 %intbool, label %loop.body, label %loop.exit + %i2b = icmp ne i32 %2, 0 + br i1 %i2b, label %loop.body, label %loop.exit loop.body: ; preds = %loop.cond %eq = icmp eq i32 %0, 1 diff --git a/test/test_suite/statements/defer_return.c3t b/test/test_suite/statements/defer_return.c3t index 968b278b7..b51506559 100644 --- a/test/test_suite/statements/defer_return.c3t +++ b/test/test_suite/statements/defer_return.c3t @@ -43,8 +43,8 @@ entry: loop.cond: ; preds = %if.exit, %entry %2 = load i32, ptr %a, align 4 - %intbool = icmp ne i32 %2, 0 - br i1 %intbool, label %loop.body, label %loop.exit + %i2b = icmp ne i32 %2, 0 + br i1 %i2b, label %loop.body, label %loop.exit loop.body: ; preds = %loop.cond %eq = icmp eq i32 %0, 1 @@ -68,8 +68,8 @@ loop.exit: ; preds = %loop.cond loop.cond1: ; preds = %loop.exit %4 = load i32, ptr %a, align 4 - %intbool2 = icmp ne i32 %4, 0 - br i1 %intbool2, label %loop.body3, label %loop.exit8 + %i2b2 = icmp ne i32 %4, 0 + br i1 %i2b2, label %loop.body3, label %loop.exit8 loop.body3: ; preds = %loop.cond1 %eq4 = icmp eq i32 %0, 1 diff --git a/test/test_suite/statements/while_switch.c3t b/test/test_suite/statements/while_switch.c3t index eb21d8b15..a3ebd15ac 100644 --- a/test/test_suite/statements/while_switch.c3t +++ b/test/test_suite/statements/while_switch.c3t @@ -51,8 +51,8 @@ entry: loop.cond: ; preds = %switch.exit, %entry %0 = call i32 @foo() - %intbool = icmp ne i32 %0, 0 - br i1 %intbool, label %loop.body, label %loop.exit + %i2b = icmp ne i32 %0, 0 + br i1 %i2b, label %loop.body, label %loop.exit loop.body: ; preds = %loop.cond %1 = call i32 @foo() diff --git a/test/test_suite/stdlib/map_linux.c3t b/test/test_suite/stdlib/map_linux.c3t index 22a109848..a5b11b0df 100644 --- a/test/test_suite/stdlib/map_linux.c3t +++ b/test/test_suite/stdlib/map_linux.c3t @@ -240,8 +240,8 @@ after_check19: ; preds = %entry, %after_check store %any %48, ptr %varargslots61, align 16 %49 = call i64 @std.io.printfn(ptr %retparam65, ptr @.str.12, i64 2, ptr %varargslots61, i64 1) %50 = load ptr, ptr @std.core.mem.allocator.thread_temp_allocator, align 8 - %not = icmp eq ptr %50, null - br i1 %not, label %if.then, label %if.exit + %i2nb = icmp eq ptr %50, null + br i1 %i2nb, label %if.then, label %if.exit if.then: ; preds = %after_check19 call void @std.core.mem.allocator.init_default_temp_allocators() diff --git a/test/test_suite/stdlib/map_macos.c3t b/test/test_suite/stdlib/map_macos.c3t index 352abcf67..98dd533cb 100644 --- a/test/test_suite/stdlib/map_macos.c3t +++ b/test/test_suite/stdlib/map_macos.c3t @@ -240,8 +240,8 @@ after_check19: ; preds = %entry, %after_check store %any %48, ptr %varargslots61, align 16 %49 = call i64 @std.io.printfn(ptr %retparam65, ptr @.str.12, i64 2, ptr %varargslots61, i64 1) %50 = load ptr, ptr @std.core.mem.allocator.thread_temp_allocator, align 8 - %not = icmp eq ptr %50, null - br i1 %not, label %if.then, label %if.exit + %i2nb = icmp eq ptr %50, null + br i1 %i2nb, label %if.then, label %if.exit if.then: ; preds = %after_check19 call void @std.core.mem.allocator.init_default_temp_allocators() diff --git a/test/test_suite/struct/struct_as_value.c3t b/test/test_suite/struct/struct_as_value.c3t index 56c8eff48..58d5a0602 100644 --- a/test/test_suite/struct/struct_as_value.c3t +++ b/test/test_suite/struct/struct_as_value.c3t @@ -27,8 +27,8 @@ entry: %taddr = alloca %Event, align 4 call void @llvm.memcpy.p0.p0.i32(ptr align 4 %foo, ptr align 4 @.__const, i32 4, i1 false) call void @llvm.memcpy.p0.p0.i32(ptr align 4 %bar, ptr align 4 @.__const.1, i32 4, i1 false) - %intbool = icmp ne i32 %0, 0 - br i1 %intbool, label %cond.lhs, label %cond.rhs + %i2b = icmp ne i32 %0, 0 + br i1 %i2b, label %cond.lhs, label %cond.rhs cond.lhs: ; preds = %entry %1 = load %Event, ptr %foo, align 4 diff --git a/test/test_suite/struct/struct_as_value_aarch64.c3t b/test/test_suite/struct/struct_as_value_aarch64.c3t index adc1e52fb..7c76ec120 100644 --- a/test/test_suite/struct/struct_as_value_aarch64.c3t +++ b/test/test_suite/struct/struct_as_value_aarch64.c3t @@ -22,8 +22,8 @@ entry: %taddr = alloca %Event, align 4 call void @llvm.memcpy.p0.p0.i32(ptr align 4 %foo, ptr align 4 @.__const, i32 4, i1 false) call void @llvm.memcpy.p0.p0.i32(ptr align 4 %bar, ptr align 4 @.__const.1, i32 4, i1 false) - %intbool = icmp ne i32 %0, 0 - br i1 %intbool, label %cond.lhs, label %cond.rhs + %i2b = icmp ne i32 %0, 0 + br i1 %i2b, label %cond.lhs, label %cond.rhs cond.lhs: ; preds = %entry %1 = load %Event, ptr %foo, align 4