diff --git a/src/compiler/llvm_codegen_expr.c b/src/compiler/llvm_codegen_expr.c index 78e38f4e3..b8c4e0144 100644 --- a/src/compiler/llvm_codegen_expr.c +++ b/src/compiler/llvm_codegen_expr.c @@ -1687,8 +1687,6 @@ void llvm_emit_initialize_reference_temporary_const(GenContext *c, BEValue *ref, bool modified = false; // First create the constant value. - Type *canonical = expr->type->canonical; - assert(expr_is_const_initializer(expr)); LLVMValueRef value = llvm_emit_const_initializer(c, expr->const_expr.initializer); @@ -1710,7 +1708,7 @@ void llvm_emit_initialize_reference_temporary_const(GenContext *c, BEValue *ref, llvm_emit_memcpy(c, ref->value, ref->alignment, global_copy, alignment, type_size(expr->type)); } -static void llvm_emit_inititialize_reference_const(GenContext *c, BEValue *ref, ConstInitializer *const_init) +static void llvm_emit_const_init_ref(GenContext *c, BEValue *ref, ConstInitializer *const_init) { switch (const_init->kind) { @@ -1738,7 +1736,7 @@ static void llvm_emit_inititialize_reference_const(GenContext *c, BEValue *ref, LLVMValueRef array_pointer = llvm_emit_array_gep_raw(c, array_ref, array_type_llvm, (unsigned)i, ref->alignment, &alignment); BEValue value; llvm_value_set_address(&value, array_pointer, element_type, alignment); - llvm_emit_inititialize_reference_const(c, &value, const_init->init_array_full[i]); + llvm_emit_const_init_ref(c, &value, const_init->init_array_full[i]); } return; } @@ -1761,7 +1759,7 @@ static void llvm_emit_inititialize_reference_const(GenContext *c, BEValue *ref, LLVMValueRef array_pointer = llvm_emit_array_gep_raw(c, array_ref, array_type_llvm, (unsigned)element_index, ref->alignment, &alignment); BEValue value; llvm_value_set_address(&value, array_pointer, element_type, alignment); - llvm_emit_inititialize_reference_const(c, &value, element->init_array_value.element); + llvm_emit_const_init_ref(c, &value, element->init_array_value.element); } return; } @@ -1775,7 +1773,7 @@ static void llvm_emit_inititialize_reference_const(GenContext *c, BEValue *ref, llvm_value_bitcast(c, &value, type); // llvm_value_set_address_abi_aligned(&value, llvm_emit_bitcast_ptr(c, ref->value, type), type); // Emit our value. - llvm_emit_inititialize_reference_const(c, &value, const_init->init_union.element); + llvm_emit_const_init_ref(c, &value, const_init->init_union.element); return; } case CONST_INIT_STRUCT: @@ -1787,7 +1785,7 @@ static void llvm_emit_inititialize_reference_const(GenContext *c, BEValue *ref, { BEValue value; llvm_value_struct_gep(c, &value, ref, (unsigned)i); - llvm_emit_inititialize_reference_const(c, &value, const_init->init_struct[i]); + llvm_emit_const_init_ref(c, &value, const_init->init_struct[i]); } return; } @@ -1800,16 +1798,16 @@ static void llvm_emit_inititialize_reference_const(GenContext *c, BEValue *ref, } } UNREACHABLE - } -static inline void llvm_emit_initialize_reference_const(GenContext *c, BEValue *ref, Expr *expr) + +static inline void llvm_emit_const_initialize_struct_union_array(GenContext *c, BEValue *ref, Expr *expr) { assert(expr_is_const_initializer(expr)); ConstInitializer *initializer = expr->const_expr.initializer; // Make sure we have an address. llvm_value_addr(c, ref); - llvm_emit_inititialize_reference_const(c, ref, initializer); + llvm_emit_const_init_ref(c, ref, initializer); } static inline void llvm_emit_initialize_reference_vector(GenContext *c, BEValue *ref, Type *real_type, Expr **elements) @@ -2287,7 +2285,7 @@ static inline void llvm_emit_const_initialize_reference(GenContext *c, BEValue * llvm_emit_initialize_reference_temporary_const(c, ref, expr); return; } - llvm_emit_initialize_reference_const(c, ref, expr); + llvm_emit_const_initialize_struct_union_array(c, ref, expr); return; } @@ -4580,7 +4578,7 @@ static inline void llvm_emit_const_initializer_list_expr(GenContext *c, BEValue return; } llvm_value_set_address_abi_aligned(value, llvm_emit_alloca_aligned(c, expr->type, "literal"), expr->type); - llvm_emit_initialize_reference_const(c, value, expr); + llvm_emit_const_initialize_reference(c, value, expr); } static void llvm_emit_const_expr(GenContext *c, BEValue *be_value, Expr *expr) diff --git a/test/test_suite/abi/darwin64_avx.c3t b/test/test_suite/abi/darwin64_avx.c3t index f1c96b818..008edc4ba 100644 --- a/test/test_suite/abi/darwin64_avx.c3t +++ b/test/test_suite/abi/darwin64_avx.c3t @@ -108,34 +108,132 @@ fn void f61(SAtwo256 s) { /* #expect: test.ll -declare void @f38(<8 x float>) -declare void @f37(<8 x float>) -declare void @func40(ptr byval(%Two128) align 16) -define void @test.func41(ptr byval(%Two128) align 16 %0) - -declare void @func42(ptr byval(%Sa) align 16) -define void @test.func43(ptr byval(%Sa) align 16 %0) - -declare void @f46(double, double, double, double, double, double, double, double, ptr byval(<2 x float>) align 8, ptr byval(<2 x float>) align 8) -declare void @f47(i32, i32, i32, i32, i32, i32, i32) - -declare void @test49_helper(double, ...) -define void @test.test49(double %0, double %1) +declare void @f38(<8 x float>) #0 +; Function Attrs: nounwind +declare void @f37(<8 x float>) #0 +; Function Attrs: nounwind +define void @test.f39() #0 { +entry: + %0 = load <8 x float>, ptr @test.x38, align 32 + call void @f38(<8 x float> %0) + %1 = load <8 x float>, ptr @test.x37, align 32 + call void @f37(<8 x float> %1) + ret void +} +; Function Attrs: nounwind +declare void @func40(ptr byval(%Two128) align 16) #0 +; Function Attrs: nounwind +define void @test.func41(ptr byval(%Two128) align 16 %0) #0 { +entry: + call void @func40(ptr byval(%Two128) align 16 %0) + ret void +} +; Function Attrs: nounwind +declare void @func42(ptr byval(%Sa) align 16) #0 +; Function Attrs: nounwind +define void @test.func43(ptr byval(%Sa) align 16 %0) #0 { +entry: + call void @func42(ptr byval(%Sa) align 16 %0) + ret void +} +; Function Attrs: nounwind +declare void @f46(double, double, double, double, double, double, double, double, ptr byval(<2 x float>) align 8, ptr byval(<2 x float>) align 8) #0 +; Function Attrs: nounwind +define void @test.test46() #0 { +entry: + %x = alloca <2 x float>, align 8 + store <2 x float> , ptr %x, align 8 + %0 = load double, ptr %x, align 8 + %1 = load double, ptr %x, align 8 + %2 = load double, ptr %x, align 8 + %3 = load double, ptr %x, align 8 + %4 = load double, ptr %x, align 8 + %5 = load double, ptr %x, align 8 + %6 = load double, ptr %x, align 8 + %7 = load double, ptr %x, align 8 + call void @f46(double %0, double %1, double %2, double %3, double %4, double %5, double %6, double %7, ptr byval(<2 x float>) align 8 %x, ptr byval(<2 x float>) align 8 %x) + ret void +} +; Function Attrs: nounwind +declare void @f47(i32, i32, i32, i32, i32, i32, i32) #0 +; Function Attrs: nounwind +define void @test.test47(i32 %0, i32 %1) #0 { +entry: + %b = alloca %Vec47, align 4 + store i32 %1, ptr %b, align 4 + %2 = load i32, ptr %b, align 4 + call void @f47(i32 %0, i32 %0, i32 %0, i32 %0, i32 %0, i32 %0, i32 %2) + ret void +} +; Function Attrs: nounwind +declare void @test49_helper(double, ...) #0 +; Function Attrs: nounwind +define void @test.test49(double %0, double %1) #0 { entry: call void (double, ...) @test49_helper(double %0, double %1) ret void - +} +; Function Attrs: nounwind +declare void @test52_helper(i32, ...) #0 +; Function Attrs: nounwind +define void @test.test52() #0 { +entry: + %literal = alloca %Complex, align 8 + %0 = load <8 x float>, ptr @test.x52, align 32 + call void @llvm.memcpy.p0.p0.i32(ptr align 8 %literal, ptr align 8 @.__const, i32 16, i1 false) + %1 = getelementptr inbounds %Complex, ptr %literal, i32 0, i32 0 + %lo = load double, ptr %1, align 8 + %2 = getelementptr inbounds %Complex, ptr %literal, i32 0, i32 1 + %hi = load double, ptr %2, align 8 call void (i32, ...) @test52_helper(i32 0, <8 x float> %0, double 1.000000e+00, double 1.000000e+00, double 1.000000e+00, double 1.000000e+00, double 1.000000e+00, double 1.000000e+00, double %lo, double %hi) + ret void +} +; Function Attrs: nounwind +declare void @test54_helper(<8 x float>, ...) #0 +; Function Attrs: nounwind +define void @test.test54() #0 { +entry: + %literal = alloca %Complex, align 8 + %literal1 = alloca %Complex, align 8 + %0 = load <8 x float>, ptr @test.x54, align 32 + %1 = load <8 x float>, ptr @test.x54, align 32 + call void @llvm.memcpy.p0.p0.i32(ptr align 8 %literal, ptr align 8 @.__const.6, i32 16, i1 false) + %2 = getelementptr inbounds %Complex, ptr %literal, i32 0, i32 0 + %lo = load double, ptr %2, align 8 + %3 = getelementptr inbounds %Complex, ptr %literal, i32 0, i32 1 + %hi = load double, ptr %3, align 8 call void (<8 x float>, ...) @test54_helper(<8 x float> %0, <8 x float> %1, double 1.000000e+00, double 1.000000e+00, double 1.000000e+00, double 1.000000e+00, double 1.000000e+00, double %lo, double %hi) - call void (<8 x float>, ...) @test54_helper(<8 x float> %6, <8 x float> %7, double 1.000000e+00, double 1.000000e+00, double 1.000000e+00, double 1.000000e+00, double 1.000000e+00, double 1.000000e+00, ptr byval(%Complex) align 8 %literal1) - -declare void @f55(ptr byval(%St512) align 64) -declare void @f56(ptr byval(<16 x float>) align 64) - -declare void @f58(ptr byval(%Two256) align 32) -define void @test.f59(ptr byval(%Two256) align 32 %0) - -declare void @f60(ptr byval(%SAtwo256) align 32) - -define void @test.f61(ptr byval(%SAtwo256) align 32 %0) + %4 = load <8 x float>, ptr @test.x54, align 32 + %5 = load <8 x float>, ptr @test.x54, align 32 + call void @llvm.memcpy.p0.p0.i32(ptr align 8 %literal1, ptr align 8 @.__const.7, i32 16, i1 false) + call void (<8 x float>, ...) @test54_helper(<8 x float> %4, <8 x float> %5, double 1.000000e+00, double 1.000000e+00, double 1.000000e+00, double 1.000000e+00, double 1.000000e+00, double 1.000000e+00, ptr byval(%Complex) align 8 %literal1) + ret void +} +; Function Attrs: nounwind +declare void @f55(ptr byval(%St512) align 64) #0 +; Function Attrs: nounwind +declare void @f56(ptr byval(<16 x float>) align 64) #0 +; Function Attrs: nounwind +define void @test.f57() #0 { +entry: + call void @f55(ptr byval(%St512) align 64 @test.x55) + call void @f56(ptr byval(<16 x float>) align 64 @test.x56) + ret void +} +; Function Attrs: nounwind +declare void @f58(ptr byval(%Two256) align 32) #0 +; Function Attrs: nounwind +define void @test.f59(ptr byval(%Two256) align 32 %0) #0 { +entry: + call void @f58(ptr byval(%Two256) align 32 %0) + ret void +} +; Function Attrs: nounwind +declare void @f60(ptr byval(%SAtwo256) align 32) #0 +; Function Attrs: nounwind +define void @test.f61(ptr byval(%SAtwo256) align 32 %0) #0 { +entry: + call void @f60(ptr byval(%SAtwo256) align 32 %0) + ret void +} \ No newline at end of file diff --git a/test/test_suite/abi/darwin64_avx512.c3t b/test/test_suite/abi/darwin64_avx512.c3t index 7d818314f..a43bc3d27 100644 --- a/test/test_suite/abi/darwin64_avx512.c3t +++ b/test/test_suite/abi/darwin64_avx512.c3t @@ -58,18 +58,78 @@ fn void f64() { /* #expect: test.ll -declare void @f55(<16 x float>) -declare void @f56(<16 x float>) -declare void @f58(ptr byval(%Two256) align 32) -define void @test.f59(ptr byval(%Two256) align 32 %0) +declare void @f55(<16 x float>) #0 -declare void @f60(ptr byval(%SAtwo256) align 32) -define void @test.f61(ptr byval(%SAtwo256) align 32 %0) +; Function Attrs: nounwind +declare void @f56(<16 x float>) #0 -define void @test.f62() +; Function Attrs: nounwind +define void @test.f57() #0 { +entry: + %0 = load <16 x float>, ptr @test.x55, align 64 + call void @f55(<16 x float> %0) + %1 = load <16 x float>, ptr @test.x56, align 64 + call void @f56(<16 x float> %1) + ret void +} + +; Function Attrs: nounwind +declare void @f58(ptr byval(%Two256) align 32) #0 + +; Function Attrs: nounwind +define void @test.f59(ptr byval(%Two256) align 32 %0) #0 { +entry: + call void @f58(ptr byval(%Two256) align 32 %0) + ret void +} + +; Function Attrs: nounwind +declare void @f60(ptr byval(%SAtwo256) align 32) #0 + +; Function Attrs: nounwind +define void @test.f61(ptr byval(%SAtwo256) align 32 %0) #0 { +entry: + call void @f60(ptr byval(%SAtwo256) align 32 %0) + ret void +} + +; Function Attrs: nounwind +declare void @f62_helper(i32, ...) #0 + +; Function Attrs: nounwind +define void @test.f62() #0 { +entry: + %literal = alloca %Complex, align 8 + %0 = load <16 x float>, ptr @test.x62, align 64 + call void @llvm.memcpy.p0.p0.i32(ptr align 8 %literal, ptr align 8 @.__const, i32 16, i1 false) + %1 = getelementptr inbounds %Complex, ptr %literal, i32 0, i32 0 + %lo = load double, ptr %1, align 8 + %2 = getelementptr inbounds %Complex, ptr %literal, i32 0, i32 1 + %hi = load double, ptr %2, align 8 call void (i32, ...) @f62_helper(i32 0, <16 x float> %0, double 1.000000e+00, double 1.000000e+00, double 1.000000e+00, double 1.000000e+00, double 1.000000e+00, double 1.000000e+00, double %lo, double %hi) + ret void +} -define void @test.f64() +; Function Attrs: nounwind +declare void @f64_helper(<16 x float>, ...) #0 + +; Function Attrs: nounwind +define void @test.f64() #0 { +entry: + %literal = alloca %Complex, align 8 + %literal1 = alloca %Complex, align 8 + %0 = load <16 x float>, ptr @test.x64, align 64 + %1 = load <16 x float>, ptr @test.x64, align 64 + call void @llvm.memcpy.p0.p0.i32(ptr align 8 %literal, ptr align 8 @.__const.4, i32 16, i1 false) + %2 = getelementptr inbounds %Complex, ptr %literal, i32 0, i32 0 + %lo = load double, ptr %2, align 8 + %3 = getelementptr inbounds %Complex, ptr %literal, i32 0, i32 1 + %hi = load double, ptr %3, align 8 call void (<16 x float>, ...) @f64_helper(<16 x float> %0, <16 x float> %1, double 1.000000e+00, double 1.000000e+00, double 1.000000e+00, double 1.000000e+00, double 1.000000e+00, double %lo, double %hi) - call void (<16 x float>, ...) @f64_helper(<16 x float> %6, <16 x float> %7, double 1.000000e+00, double 1.000000e+00, double 1.000000e+00, double 1.000000e+00, double 1.000000e+00, double 1.000000e+00, ptr byval(%Complex) align 8 %literal1) + %4 = load <16 x float>, ptr @test.x64, align 64 + %5 = load <16 x float>, ptr @test.x64, align 64 + call void @llvm.memcpy.p0.p0.i32(ptr align 8 %literal1, ptr align 8 @.__const.5, i32 16, i1 false) + call void (<16 x float>, ...) @f64_helper(<16 x float> %4, <16 x float> %5, double 1.000000e+00, double 1.000000e+00, double 1.000000e+00, double 1.000000e+00, double 1.000000e+00, double 1.000000e+00, ptr byval(%Complex) align 8 %literal1) + ret void +} diff --git a/test/test_suite/abi/darwin_return_boolarray.c3t b/test/test_suite/abi/darwin_return_boolarray.c3t index 3b1f4499b..6bf19c84b 100644 --- a/test/test_suite/abi/darwin_return_boolarray.c3t +++ b/test/test_suite/abi/darwin_return_boolarray.c3t @@ -5,13 +5,19 @@ fn bool[2] get() { return { false, false }; } /* #expect: test.ll +source_filename = "test" +target datalayout = "e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" +target triple = "x86_64-apple-darwin" +@.__const = private unnamed_addr constant [2 x i8] zeroinitializer, align 1 +; Function Attrs: nounwind define i16 @test.get() #0 { entry: %literal = alloca [2 x i8], align 1 - %0 = getelementptr inbounds [2 x i8], ptr %literal, i64 0, i64 0 - store i8 0, ptr %0, align 1 - %1 = getelementptr inbounds [2 x i8], ptr %literal, i64 0, i64 1 - store i8 0, ptr %1, align 1 - %2 = load i16, ptr %literal, align 1 - ret i16 %2 -} \ No newline at end of file + call void @llvm.memcpy.p0.p0.i32(ptr align 1 %literal, ptr align 1 @.__const, i32 2, i1 false) + %0 = load i16, ptr %literal, align 1 + ret i16 %0 +} +; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite) +declare void @llvm.memcpy.p0.p0.i32(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i32, i1 immarg) #1 +attributes #0 = { nounwind } +attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) } \ No newline at end of file diff --git a/test/test_suite/abi/riscv32-ilp32-ilp32f-ilp32d-abi-1.c3t b/test/test_suite/abi/riscv32-ilp32-ilp32f-ilp32d-abi-1.c3t index aa06e0b3f..b29bf49e1 100644 --- a/test/test_suite/abi/riscv32-ilp32-ilp32f-ilp32d-abi-1.c3t +++ b/test/test_suite/abi/riscv32-ilp32-ilp32f-ilp32d-abi-1.c3t @@ -218,17 +218,17 @@ define float @test.f_fp_scalar_1(float %0) #0 { entry: ret float %0 } - +; Function Attrs: nounwind define double @test.f_fp_scalar_2(double %0) #0 { entry: ret double %0 } - +; Function Attrs: nounwind define fp128 @test.f_fp_scalar_3(fp128 %0) #0 { entry: ret fp128 %0 } - +; Function Attrs: nounwind define void @test.f_agg_tiny(i32 %0) #0 { entry: %x = alloca %Tiny, align 1 @@ -251,18 +251,11 @@ entry: define i32 @test.f_agg_tiny_ret() #0 { entry: %literal = alloca %Tiny, align 1 - %0 = getelementptr inbounds %Tiny, ptr %literal, i32 0, i32 0 - store i8 1, ptr %0, align 1 - %1 = getelementptr inbounds %Tiny, ptr %literal, i32 0, i32 1 - store i8 2, ptr %1, align 1 - %2 = getelementptr inbounds %Tiny, ptr %literal, i32 0, i32 2 - store i8 3, ptr %2, align 1 - %3 = getelementptr inbounds %Tiny, ptr %literal, i32 0, i32 3 - store i8 4, ptr %3, align 1 - %4 = load i32, ptr %literal, align 1 - ret i32 %4 + call void @llvm.memcpy.p0.p0.i32(ptr align 1 %literal, ptr align 1 @.__const, i32 4, i1 false) + %0 = load i32, ptr %literal, align 1 + ret i32 %0 } - +; Function Attrs: nounwind define void @test.f_vec_tiny_v4i8(i32 %0) #0 { entry: %x = alloca <4 x i8>, align 4 @@ -279,7 +272,7 @@ entry: store <4 x i8> %elemset1, ptr %x, align 4 ret void } - +; Function Attrs: nounwind define i32 @test.f_vec_tiny_v4i8_ret() #0 { entry: %taddr = alloca <4 x i8>, align 4 @@ -287,8 +280,7 @@ entry: %0 = load i32, ptr %taddr, align 4 ret i32 %0 } - - +; Function Attrs: nounwind define void @test.f_vec_tiny_v1i32(i32 %0) #0 { entry: %x = alloca <1 x i32>, align 4 @@ -298,7 +290,7 @@ entry: store <1 x i32> %elemset, ptr %x, align 4 ret void } - +; Function Attrs: nounwind define i32 @test.f_vec_tiny_v1i32_ret() #0 { entry: %taddr = alloca <1 x i32>, align 4 @@ -306,7 +298,7 @@ entry: %0 = load i32, ptr %taddr, align 4 ret i32 %0 } - +; Function Attrs: nounwind define void @test.f_agg_small([2 x i32] %0) #0 { entry: %x = alloca %Small, align 4 @@ -323,18 +315,15 @@ entry: store ptr %7, ptr %6, align 4 ret void } - +; Function Attrs: nounwind define [2 x i32] @test.f_agg_small_ret() #0 { entry: %literal = alloca %Small, align 4 - %0 = getelementptr inbounds %Small, ptr %literal, i32 0, i32 0 - store i32 1, ptr %0, align 4 - %1 = getelementptr inbounds %Small, ptr %literal, i32 0, i32 1 - store ptr null, ptr %1, align 4 - %2 = load [2 x i32], ptr %literal, align 4 - ret [2 x i32] %2 + call void @llvm.memcpy.p0.p0.i32(ptr align 4 %literal, ptr align 4 @.__const.1, i32 8, i1 false) + %0 = load [2 x i32], ptr %literal, align 4 + ret [2 x i32] %0 } - +; Function Attrs: nounwind define void @test.f_vec_small_v8i8(i64 %0) #0 { entry: %x = alloca <8 x i8>, align 8 @@ -346,7 +335,7 @@ entry: store <8 x i8> %elemset, ptr %x, align 8 ret void } - +; Function Attrs: nounwind define i64 @test.f_vec_small_v8i8_ret() #0 { entry: %taddr = alloca <8 x i8>, align 8 @@ -354,7 +343,7 @@ entry: %0 = load i64, ptr %taddr, align 8 ret i64 %0 } - +; Function Attrs: nounwind define void @test.f_vec_small_v1i64(i64 %0) #0 { entry: %x = alloca <1 x i64>, align 8 @@ -364,7 +353,7 @@ entry: store <1 x i64> %elemset, ptr %x, align 8 ret void } - +; Function Attrs: nounwind define i64 @test.f_vec_small_v1i64_ret() #0 { entry: %taddr = alloca <1 x i64>, align 8 @@ -372,7 +361,7 @@ entry: %0 = load i64, ptr %taddr, align 8 ret i64 %0 } - +; Function Attrs: nounwind define void @test.f_agg_small_aligned(i64 %0) #0 { entry: %x = alloca %Small_aligned, align 8 @@ -385,18 +374,17 @@ entry: store i64 %add, ptr %1, align 8 ret void } - +; Function Attrs: nounwind define i64 @test.f_agg_small_aligned_ret(i64 %0) #0 { entry: %x = alloca %Small_aligned, align 8 %literal = alloca %Small_aligned, align 8 store i64 %0, ptr %x, align 8 - %1 = getelementptr inbounds %Small_aligned, ptr %literal, i32 0, i32 0 - store i64 10, ptr %1, align 8 - %2 = load i64, ptr %literal, align 8 - ret i64 %2 + call void @llvm.memcpy.p0.p0.i32(ptr align 8 %literal, ptr align 8 @.__const.2, i32 8, i1 false) + %1 = load i64, ptr %literal, align 8 + ret i64 %1 } - +; Function Attrs: nounwind define void @test.f_agg_large(ptr align 4 %0) #0 { entry: %1 = getelementptr inbounds %Large, ptr %0, i32 0, i32 0 @@ -411,22 +399,15 @@ entry: store i32 %add1, ptr %1, align 4 ret void } - +; Function Attrs: nounwind define void @test.f_agg_large_ret(ptr noalias sret(%Large) align 4 %0, i32 %1, i8 signext %2) #0 { entry: %literal = alloca %Large, align 4 - %3 = getelementptr inbounds %Large, ptr %literal, i32 0, i32 0 - store i32 1, ptr %3, align 4 - %4 = getelementptr inbounds %Large, ptr %literal, i32 0, i32 1 - store i32 2, ptr %4, align 4 - %5 = getelementptr inbounds %Large, ptr %literal, i32 0, i32 2 - store i32 3, ptr %5, align 4 - %6 = getelementptr inbounds %Large, ptr %literal, i32 0, i32 3 - store i32 4, ptr %6, align 4 + call void @llvm.memcpy.p0.p0.i32(ptr align 4 %literal, ptr align 4 @.__const.3, i32 16, i1 false) call void @llvm.memcpy.p0.p0.i32(ptr align 4 %0, ptr align 4 %literal, i32 16, i1 false) ret void } - +; Function Attrs: nounwind define void @test.f_vec_large_v16i8(ptr align 16 %0) #0 { entry: %1 = load <16 x i8>, ptr %0, align 16 @@ -436,13 +417,13 @@ entry: store <16 x i8> %elemset, ptr %0, align 16 ret void } - +; Function Attrs: nounwind define void @test.f_vec_large_v16i8_ret(ptr noalias sret(<16 x i8>) align 16 %0) #0 { entry: store <16 x i8> , ptr %0, align 16 ret void } - +; Function Attrs: nounwind define i32 @test.f_scalar_stack_1(i32 %0, [2 x i32] %1, i64 %2, ptr align 4 %3, i8 zeroext %4, i8 signext %5, i8 %6, i8 %7) #0 { entry: %a = alloca %Tiny, align 1 @@ -456,7 +437,7 @@ entry: %add = add i32 %zext, %sext ret i32 %add } - +; Function Attrs: nounwind define void @test.f_scalar_stack_2(ptr noalias sret(%Large) align 4 %0, i32 %1, i64 %2, i64 %3, fp128 %4, i8 zeroext %5, i8 %6, i8 %7) #0 { entry: %literal = alloca %Large, align 4 @@ -474,17 +455,17 @@ entry: call void @llvm.memcpy.p0.p0.i32(ptr align 4 %0, ptr align 4 %literal, i32 16, i1 false) ret void } - +; Function Attrs: nounwind define fp128 @test.f_scalar_stack_4(i32 %0, i64 %1, i64 %2, fp128 %3, i8 zeroext %4, i8 %5, i8 %6) #0 { entry: ret fp128 %3 } - +; Function Attrs: nounwind define void @test.f_scalar_stack_5(double %0, i64 %1, double %2, i64 %3, i32 %4, i64 %5, float %6, double %7, fp128 %8) #0 { entry: ret void } - +; Function Attrs: nounwind define void @test.f_agg_stack(double %0, i64 %1, double %2, i64 %3, i32 %4, [2 x i32] %5, i64 %6, ptr align 4 %7) #0 { entry: %e = alloca %Tiny, align 1 @@ -495,7 +476,9 @@ entry: store i64 %6, ptr %g, align 8 ret void } - +; Function Attrs: nounwind +declare i32 @f_va_callee(i32, ...) #0 +; Function Attrs: nounwind define void @test.f_va_caller() #0 { entry: %literal = alloca %Tiny, align 1 @@ -503,32 +486,14 @@ entry: %literal2 = alloca %Small_aligned, align 8 %literal3 = alloca %Large, align 4 %indirectarg = alloca %Large, align 4 - %0 = getelementptr inbounds %Tiny, ptr %literal, i32 0, i32 0 - store i8 6, ptr %0, align 1 - %1 = getelementptr inbounds %Tiny, ptr %literal, i32 0, i32 1 - store i8 7, ptr %1, align 1 - %2 = getelementptr inbounds %Tiny, ptr %literal, i32 0, i32 2 - store i8 8, ptr %2, align 1 - %3 = getelementptr inbounds %Tiny, ptr %literal, i32 0, i32 3 - store i8 9, ptr %3, align 1 - %4 = load i32, ptr %literal, align 1 - %5 = getelementptr inbounds %Small, ptr %literal1, i32 0, i32 0 - store i32 10, ptr %5, align 4 - %6 = getelementptr inbounds %Small, ptr %literal1, i32 0, i32 1 - store ptr null, ptr %6, align 4 - %7 = load [2 x i32], ptr %literal1, align 4 - %8 = getelementptr inbounds %Small_aligned, ptr %literal2, i32 0, i32 0 - store i64 11, ptr %8, align 8 - %9 = load i64, ptr %literal2, align 8 - %10 = getelementptr inbounds %Large, ptr %literal3, i32 0, i32 0 - store i32 12, ptr %10, align 4 - %11 = getelementptr inbounds %Large, ptr %literal3, i32 0, i32 1 - store i32 13, ptr %11, align 4 - %12 = getelementptr inbounds %Large, ptr %literal3, i32 0, i32 2 - store i32 14, ptr %12, align 4 - %13 = getelementptr inbounds %Large, ptr %literal3, i32 0, i32 3 - store i32 15, ptr %13, align 4 + call void @llvm.memcpy.p0.p0.i32(ptr align 1 %literal, ptr align 1 @.__const.4, i32 4, i1 false) + %0 = load i32, ptr %literal, align 1 + call void @llvm.memcpy.p0.p0.i32(ptr align 4 %literal1, ptr align 4 @.__const.5, i32 8, i1 false) + %1 = load [2 x i32], ptr %literal1, align 4 + call void @llvm.memcpy.p0.p0.i32(ptr align 8 %literal2, ptr align 8 @.__const.6, i32 8, i1 false) + %2 = load i64, ptr %literal2, align 8 + call void @llvm.memcpy.p0.p0.i32(ptr align 4 %literal3, ptr align 4 @.__const.7, i32 16, i1 false) call void @llvm.memcpy.p0.p0.i32(ptr align 4 %indirectarg, ptr align 4 %literal3, i32 16, i1 false) - %14 = call i32 (i32, ...) @f_va_callee(i32 1, i32 2, i32 3, double 4.000000e+00, double 5.000000e+00, i32 %4, [2 x i32] %7, i64 %9, ptr align 4 %indirectarg) + %3 = call i32 (i32, ...) @f_va_callee(i32 1, i32 2, i32 3, double 4.000000e+00, double 5.000000e+00, i32 %0, [2 x i32] %1, i64 %2, ptr align 4 %indirectarg) ret void } \ No newline at end of file diff --git a/test/test_suite/abi/riscv32-ilp32-ilp32f-ilp32d-abi-2.c3t b/test/test_suite/abi/riscv32-ilp32-ilp32f-ilp32d-abi-2.c3t index 579897854..a7fcf14a6 100644 --- a/test/test_suite/abi/riscv32-ilp32-ilp32f-ilp32d-abi-2.c3t +++ b/test/test_suite/abi/riscv32-ilp32-ilp32f-ilp32d-abi-2.c3t @@ -182,69 +182,344 @@ fn void f_va_caller() { define void @test.f_void() -define zeroext i8 @test.f_scalar_0(i8 zeroext %0) +; Function Attrs: nounwind +define signext i8 @test.f_scalar_1(i8 signext %0) #0 { +entry: + ret i8 %0 +} -define signext i8 @test.f_scalar_1(i8 signext %0) +; Function Attrs: nounwind +define zeroext i8 @test.f_scalar_2(i8 zeroext %0) #0 { +entry: + ret i8 %0 +} -define zeroext i8 @test.f_scalar_2(i8 zeroext %0) +; Function Attrs: nounwind +define i32 @test.f_scalar_3(i32 %0) #0 { +entry: + ret i32 %0 +} -define i32 @test.f_scalar_3(i32 %0) +; Function Attrs: nounwind +define i64 @test.f_scalar_4(i64 %0) #0 { +entry: + ret i64 %0 +} -define i64 @test.f_scalar_4(i64 %0) +; Function Attrs: nounwind +define i128 @test.f_scalar_5(i128 %0) #0 { +entry: + ret i128 %0 +} -define i128 @test.f_scalar_5(i128 %0) +; Function Attrs: nounwind +define float @test.f_fp_scalar_1(float %0) #0 { +entry: + ret float %0 +} -define float @test.f_fp_scalar_1(float %0) +; Function Attrs: nounwind +define double @test.f_fp_scalar_2(double %0) #0 { +entry: + ret double %0 +} -define double @test.f_fp_scalar_2(double %0) +; Function Attrs: nounwind +define fp128 @test.f_fp_scalar_3(fp128 %0) #0 { +entry: + ret fp128 %0 +} -define fp128 @test.f_fp_scalar_3(fp128 %0) +; Function Attrs: nounwind +define void @test.f_agg_tiny(i32 %0) #0 { +entry: + %x = alloca %Tiny, align 1 + store i32 %0, ptr %x, align 1 + %1 = getelementptr inbounds %Tiny, ptr %x, i32 0, i32 0 + %2 = load i8, ptr %1, align 1 + %3 = getelementptr inbounds %Tiny, ptr %x, i32 0, i32 1 + %4 = load i8, ptr %3, align 1 + %add = add i8 %2, %4 + store i8 %add, ptr %1, align 1 + %5 = getelementptr inbounds %Tiny, ptr %x, i32 0, i32 2 + %6 = load i8, ptr %5, align 1 + %7 = getelementptr inbounds %Tiny, ptr %x, i32 0, i32 3 + %8 = load i8, ptr %7, align 1 + %add1 = add i8 %6, %8 + store i8 %add1, ptr %5, align 1 + ret void +} -define void @test.f_agg_tiny(i32 %0) +; Function Attrs: nounwind +define i32 @test.f_agg_tiny_ret() #0 { +entry: + %literal = alloca %Tiny, align 1 + call void @llvm.memcpy.p0.p0.i32(ptr align 1 %literal, ptr align 1 @.__const, i32 4, i1 false) + %0 = load i32, ptr %literal, align 1 + ret i32 %0 +} -define i32 @test.f_agg_tiny_ret() +; Function Attrs: nounwind +define void @test.f_vec_tiny_v4i8(i32 %0) #0 { +entry: + %x = alloca <4 x i8>, align 4 + store i32 %0, ptr %x, align 4 + %1 = load <4 x i8>, ptr %x, align 4 + %2 = load <4 x i8>, ptr %x, align 4 + %3 = extractelement <4 x i8> %2, i32 1 + %elemset = insertelement <4 x i8> %1, i8 %3, i32 0 + store <4 x i8> %elemset, ptr %x, align 4 + %4 = load <4 x i8>, ptr %x, align 4 + %5 = load <4 x i8>, ptr %x, align 4 + %6 = extractelement <4 x i8> %5, i32 3 + %elemset1 = insertelement <4 x i8> %4, i8 %6, i32 2 + store <4 x i8> %elemset1, ptr %x, align 4 + ret void +} -define void @test.f_vec_tiny_v4i8(i32 %0) +; Function Attrs: nounwind +define i32 @test.f_vec_tiny_v4i8_ret() #0 { +entry: + %taddr = alloca <4 x i8>, align 4 + store <4 x i8> , ptr %taddr, align 4 + %0 = load i32, ptr %taddr, align 4 + ret i32 %0 +} -define i32 @test.f_vec_tiny_v4i8_ret() +; Function Attrs: nounwind +define void @test.f_vec_tiny_v1i32(i32 %0) #0 { +entry: + %x = alloca <1 x i32>, align 4 + store i32 %0, ptr %x, align 4 + %1 = load <1 x i32>, ptr %x, align 4 + %elemset = insertelement <1 x i32> %1, i32 114, i32 0 + store <1 x i32> %elemset, ptr %x, align 4 + ret void +} -define void @test.f_vec_tiny_v1i32(i32 %0) +; Function Attrs: nounwind +define i32 @test.f_vec_tiny_v1i32_ret() #0 { +entry: + %taddr = alloca <1 x i32>, align 4 + store <1 x i32> , ptr %taddr, align 4 + %0 = load i32, ptr %taddr, align 4 + ret i32 %0 +} -define i32 @test.f_vec_tiny_v1i32_ret() +; Function Attrs: nounwind +define void @test.f_agg_small([2 x i32] %0) #0 { +entry: + %x = alloca %Small, align 4 + store [2 x i32] %0, ptr %x, align 4 + %1 = getelementptr inbounds %Small, ptr %x, i32 0, i32 0 + %2 = load i32, ptr %1, align 4 + %3 = getelementptr inbounds %Small, ptr %x, i32 0, i32 1 + %4 = load ptr, ptr %3, align 4 + %5 = load i32, ptr %4, align 4 + %add = add i32 %2, %5 + store i32 %add, ptr %1, align 4 + %6 = getelementptr inbounds %Small, ptr %x, i32 0, i32 1 + %7 = getelementptr inbounds %Small, ptr %x, i32 0, i32 0 + store ptr %7, ptr %6, align 4 + ret void +} -define void @test.f_agg_small([2 x i32] %0) +; Function Attrs: nounwind +define [2 x i32] @test.f_agg_small_ret() #0 { +entry: + %literal = alloca %Small, align 4 + call void @llvm.memcpy.p0.p0.i32(ptr align 4 %literal, ptr align 4 @.__const.1, i32 8, i1 false) + %0 = load [2 x i32], ptr %literal, align 4 + ret [2 x i32] %0 +} -define [2 x i32] @test.f_agg_small_ret() +; Function Attrs: nounwind +define void @test.f_vec_small_v8i8(i64 %0) #0 { +entry: + %x = alloca <8 x i8>, align 8 + store i64 %0, ptr %x, align 8 + %1 = load <8 x i8>, ptr %x, align 8 + %2 = load <8 x i8>, ptr %x, align 8 + %3 = extractelement <8 x i8> %2, i32 7 + %elemset = insertelement <8 x i8> %1, i8 %3, i32 0 + store <8 x i8> %elemset, ptr %x, align 8 + ret void +} -define void @test.f_vec_small_v8i8(i64 %0) +; Function Attrs: nounwind +define i64 @test.f_vec_small_v8i8_ret() #0 { +entry: + %taddr = alloca <8 x i8>, align 8 + store <8 x i8> , ptr %taddr, align 8 + %0 = load i64, ptr %taddr, align 8 + ret i64 %0 +} -define i64 @test.f_vec_small_v8i8_ret() +; Function Attrs: nounwind +define void @test.f_vec_small_v1i64(i64 %0) #0 { +entry: + %x = alloca <1 x i64>, align 8 + store i64 %0, ptr %x, align 8 + %1 = load <1 x i64>, ptr %x, align 8 + %elemset = insertelement <1 x i64> %1, i64 114, i32 0 + store <1 x i64> %elemset, ptr %x, align 8 + ret void +} -define void @test.f_vec_small_v1i64(i64 %0) +; Function Attrs: nounwind +define i64 @test.f_vec_small_v1i64_ret() #0 { +entry: + %taddr = alloca <1 x i64>, align 8 + store <1 x i64> , ptr %taddr, align 8 + %0 = load i64, ptr %taddr, align 8 + ret i64 %0 +} -define i64 @test.f_vec_small_v1i64_ret() +; Function Attrs: nounwind +define void @test.f_agg_small_aligned(i64 %0) #0 { +entry: + %x = alloca %Small_aligned, align 8 + store i64 %0, ptr %x, align 8 + %1 = getelementptr inbounds %Small_aligned, ptr %x, i32 0, i32 0 + %2 = load i64, ptr %1, align 8 + %3 = getelementptr inbounds %Small_aligned, ptr %x, i32 0, i32 0 + %4 = load i64, ptr %3, align 8 + %add = add i64 %2, %4 + store i64 %add, ptr %1, align 8 + ret void +} -define void @test.f_agg_small_aligned(i64 %0) +; Function Attrs: nounwind +define i64 @test.f_agg_small_aligned_ret(i64 %0) #0 { +entry: + %x = alloca %Small_aligned, align 8 + %literal = alloca %Small_aligned, align 8 + store i64 %0, ptr %x, align 8 + call void @llvm.memcpy.p0.p0.i32(ptr align 8 %literal, ptr align 8 @.__const.2, i32 8, i1 false) + %1 = load i64, ptr %literal, align 8 + ret i64 %1 +} -define i64 @test.f_agg_small_aligned_ret(i64 %0) +; Function Attrs: nounwind +define void @test.f_agg_large(ptr align 4 %0) #0 { +entry: + %1 = getelementptr inbounds %Large, ptr %0, i32 0, i32 0 + %2 = getelementptr inbounds %Large, ptr %0, i32 0, i32 1 + %3 = load i32, ptr %2, align 4 + %4 = getelementptr inbounds %Large, ptr %0, i32 0, i32 2 + %5 = load i32, ptr %4, align 4 + %add = add i32 %3, %5 + %6 = getelementptr inbounds %Large, ptr %0, i32 0, i32 3 + %7 = load i32, ptr %6, align 4 + %add1 = add i32 %add, %7 + store i32 %add1, ptr %1, align 4 + ret void +} -define void @test.f_agg_large(ptr align 4 %0) +; Function Attrs: nounwind +define void @test.f_agg_large_ret(ptr noalias sret(%Large) align 4 %0, i32 %1, i8 signext %2) #0 { +entry: + %literal = alloca %Large, align 4 + call void @llvm.memcpy.p0.p0.i32(ptr align 4 %literal, ptr align 4 @.__const.3, i32 16, i1 false) + call void @llvm.memcpy.p0.p0.i32(ptr align 4 %0, ptr align 4 %literal, i32 16, i1 false) + ret void +} -define void @test.f_agg_large_ret(ptr noalias sret(%Large) align 4 %0, i32 %1, i8 signext %2) +; Function Attrs: nounwind +define void @test.f_vec_large_v16i8(ptr align 16 %0) #0 { +entry: + %1 = load <16 x i8>, ptr %0, align 16 + %2 = load <16 x i8>, ptr %0, align 16 + %3 = extractelement <16 x i8> %2, i32 7 + %elemset = insertelement <16 x i8> %1, i8 %3, i32 0 + store <16 x i8> %elemset, ptr %0, align 16 + ret void +} -define void @test.f_vec_large_v16i8(ptr align 16 %0) +; Function Attrs: nounwind +define void @test.f_vec_large_v16i8_ret(ptr noalias sret(<16 x i8>) align 16 %0) #0 { +entry: + store <16 x i8> , ptr %0, align 16 + ret void +} -define void @test.f_vec_large_v16i8_ret(ptr noalias sret(<16 x i8>) align 16 %0) +; Function Attrs: nounwind +define i32 @test.f_scalar_stack_1(i32 %0, [2 x i32] %1, i64 %2, ptr align 4 %3, i8 zeroext %4, i8 signext %5, i8 %6, i8 %7) #0 { +entry: + %a = alloca %Tiny, align 1 + %b = alloca %Small, align 4 + %c = alloca %Small_aligned, align 8 + store i32 %0, ptr %a, align 1 + store [2 x i32] %1, ptr %b, align 4 + store i64 %2, ptr %c, align 8 + %zext = zext i8 %6 to i32 + %sext = sext i8 %7 to i32 + %add = add i32 %zext, %sext + ret i32 %add +} -define i32 @test.f_scalar_stack_1(i32 %0, [2 x i32] %1, i64 %2, ptr align 4 %3, i8 zeroext %4, i8 signext %5, i8 %6, i8 %7) +; Function Attrs: nounwind +define void @test.f_scalar_stack_2(ptr noalias sret(%Large) align 4 %0, i32 %1, i64 %2, i64 %3, fp128 %4, i8 zeroext %5, i8 %6, i8 %7) #0 { +entry: + %literal = alloca %Large, align 4 + %8 = getelementptr inbounds %Large, ptr %literal, i32 0, i32 0 + store i32 %1, ptr %8, align 4 + %9 = getelementptr inbounds %Large, ptr %literal, i32 0, i32 1 + %zext = zext i8 %5 to i32 + store i32 %zext, ptr %9, align 4 + %10 = getelementptr inbounds %Large, ptr %literal, i32 0, i32 2 + %sext = sext i8 %6 to i32 + store i32 %sext, ptr %10, align 4 + %11 = getelementptr inbounds %Large, ptr %literal, i32 0, i32 3 + %zext1 = zext i8 %7 to i32 + store i32 %zext1, ptr %11, align 4 + call void @llvm.memcpy.p0.p0.i32(ptr align 4 %0, ptr align 4 %literal, i32 16, i1 false) + ret void +} -define void @test.f_scalar_stack_2(ptr noalias sret(%Large) align 4 %0, i32 %1, i64 %2, i64 %3, fp128 %4, i8 zeroext %5, i8 %6, i8 %7) +; Function Attrs: nounwind +define fp128 @test.f_scalar_stack_4(i32 %0, i64 %1, i64 %2, fp128 %3, i8 zeroext %4, i8 %5, i8 %6) #0 { +entry: + ret fp128 %3 +} -define fp128 @test.f_scalar_stack_4(i32 %0, i64 %1, i64 %2, fp128 %3, i8 zeroext %4, i8 %5, i8 %6) +; Function Attrs: nounwind +define void @test.f_scalar_stack_5(double %0, i64 %1, double %2, i64 %3, i32 %4, i64 %5, float %6, double %7, fp128 %8) #0 { +entry: + ret void +} -define void @test.f_scalar_stack_5(double %0, i64 %1, double %2, i64 %3, i32 %4, i64 %5, float %6, double %7, fp128 %8) +; Function Attrs: nounwind +define void @test.f_agg_stack(double %0, i64 %1, double %2, i64 %3, i32 %4, [2 x i32] %5, i64 %6, ptr align 4 %7) #0 { +entry: + %e = alloca %Tiny, align 1 + %f = alloca %Small, align 4 + %g = alloca %Small_aligned, align 8 + store i32 %4, ptr %e, align 1 + store [2 x i32] %5, ptr %f, align 4 + store i64 %6, ptr %g, align 8 + ret void +} -define void @test.f_agg_stack(double %0, i64 %1, double %2, i64 %3, i32 %4, [2 x i32] %5, i64 %6, ptr align 4 %7) +; Function Attrs: nounwind +declare i32 @f_va_callee(i32, ...) #0 -define void @test.f_va_caller() -call i32 (i32, ...) @f_va_callee(i32 1, i32 2, i32 3, double 4.000000e+00, double 5.000000e+00, i32 %4, [2 x i32] %7, i64 %9, ptr align 4 %indirectarg) +; Function Attrs: nounwind +define void @test.f_va_caller() #0 { +entry: + %literal = alloca %Tiny, align 1 + %literal1 = alloca %Small, align 4 + %literal2 = alloca %Small_aligned, align 8 + %literal3 = alloca %Large, align 4 + %indirectarg = alloca %Large, align 4 + call void @llvm.memcpy.p0.p0.i32(ptr align 1 %literal, ptr align 1 @.__const.4, i32 4, i1 false) + %0 = load i32, ptr %literal, align 1 + call void @llvm.memcpy.p0.p0.i32(ptr align 4 %literal1, ptr align 4 @.__const.5, i32 8, i1 false) + %1 = load [2 x i32], ptr %literal1, align 4 + call void @llvm.memcpy.p0.p0.i32(ptr align 8 %literal2, ptr align 8 @.__const.6, i32 8, i1 false) + %2 = load i64, ptr %literal2, align 8 + call void @llvm.memcpy.p0.p0.i32(ptr align 4 %literal3, ptr align 4 @.__const.7, i32 16, i1 false) + call void @llvm.memcpy.p0.p0.i32(ptr align 4 %indirectarg, ptr align 4 %literal3, i32 16, i1 false) + %3 = call i32 (i32, ...) @f_va_callee(i32 1, i32 2, i32 3, double 4.000000e+00, double 5.000000e+00, i32 %0, [2 x i32] %1, i64 %2, ptr align 4 %indirectarg) + ret void +} diff --git a/test/test_suite/abi/riscv32-ilp32-ilp32f-ilp32d-abi-3.c3t b/test/test_suite/abi/riscv32-ilp32-ilp32f-ilp32d-abi-3.c3t index 7f4a6e875..58e454cfe 100644 --- a/test/test_suite/abi/riscv32-ilp32-ilp32f-ilp32d-abi-3.c3t +++ b/test/test_suite/abi/riscv32-ilp32-ilp32f-ilp32d-abi-3.c3t @@ -180,71 +180,321 @@ fn void f_va_caller() { /* #expect: test.ll -define void @test.f_void() - +define void @test.f_void() #0 { +entry: + ret void +} +; Function Attrs: nounwind define zeroext i8 @test.f_scalar_0(i8 zeroext %0) #0 { - -define signext i8 @test.f_scalar_1(i8 signext %0) - -define zeroext i8 @test.f_scalar_2(i8 zeroext %0) - -define i32 @test.f_scalar_3(i32 %0) - -define i64 @test.f_scalar_4(i64 %0) - -define i128 @test.f_scalar_5(i128 %0) - -define float @test.f_fp_scalar_1(float %0) - -define double @test.f_fp_scalar_2(double %0) - -define fp128 @test.f_fp_scalar_3(fp128 %0) - -define void @test.f_agg_tiny(i32 %0) - -define i32 @test.f_agg_tiny_ret() - -define void @test.f_vec_tiny_v4i8(i32 %0) - -define i32 @test.f_vec_tiny_v4i8_ret() - -define void @test.f_vec_tiny_v1i32(i32 %0) - -define i32 @test.f_vec_tiny_v1i32_ret() - -define void @test.f_agg_small([2 x i32] %0) - -define [2 x i32] @test.f_agg_small_ret() - -define void @test.f_vec_small_v8i8(i64 %0) - -define i64 @test.f_vec_small_v8i8_ret() - -define void @test.f_vec_small_v1i64(i64 %0) - -define i64 @test.f_vec_small_v1i64_ret() - -define void @test.f_agg_small_aligned(i64 %0) - -define i64 @test.f_agg_small_aligned_ret(i64 %0) - -define void @test.f_agg_large(ptr align 4 %0) - -define void @test.f_agg_large_ret(ptr noalias sret(%Large) align 4 %0, i32 %1, i8 signext %2) - -define void @test.f_vec_large_v16i8(ptr align 16 %0) - -define void @test.f_vec_large_v16i8_ret(ptr noalias sret(<16 x i8>) align 16 %0) - -define i32 @test.f_scalar_stack_1(i32 %0, [2 x i32] %1, i64 %2, ptr align 4 %3, i8 zeroext %4, i8 signext %5, i8 %6, i8 %7) - -define void @test.f_scalar_stack_2(ptr noalias sret(%Large) align 4 %0, i32 %1, i64 %2, i64 %3, fp128 %4, i8 zeroext %5, i8 %6, i8 %7) - -define fp128 @test.f_scalar_stack_4(i32 %0, i64 %1, i64 %2, fp128 %3, i8 zeroext %4, i8 %5, i8 %6) - -define void @test.f_scalar_stack_5(double %0, i64 %1, double %2, i64 %3, i32 %4, i64 %5, float %6, double %7, fp128 %8) - -define void @test.f_agg_stack(double %0, i64 %1, double %2, i64 %3, i32 %4, [2 x i32] %5, i64 %6, ptr align 4 %7) - -define void @test.f_va_caller() -call i32 (i32, ...) @f_va_callee(i32 1, i32 2, i32 3, double 4.000000e+00, double 5.000000e+00, i32 %4, [2 x i32] %7, i64 %9, ptr align 4 %indirectarg) +entry: + ret i8 %0 +} +; Function Attrs: nounwind +define signext i8 @test.f_scalar_1(i8 signext %0) #0 { +entry: + ret i8 %0 +} +; Function Attrs: nounwind +define zeroext i8 @test.f_scalar_2(i8 zeroext %0) #0 { +entry: + ret i8 %0 +} +; Function Attrs: nounwind +define i32 @test.f_scalar_3(i32 %0) #0 { +entry: + ret i32 %0 +} +; Function Attrs: nounwind +define i64 @test.f_scalar_4(i64 %0) #0 { +entry: + ret i64 %0 +} +; Function Attrs: nounwind +define i128 @test.f_scalar_5(i128 %0) #0 { +entry: + ret i128 %0 +} +; Function Attrs: nounwind +define float @test.f_fp_scalar_1(float %0) #0 { +entry: + ret float %0 +} +; Function Attrs: nounwind +define double @test.f_fp_scalar_2(double %0) #0 { +entry: + ret double %0 +} +; Function Attrs: nounwind +define fp128 @test.f_fp_scalar_3(fp128 %0) #0 { +entry: + ret fp128 %0 +} +; Function Attrs: nounwind +define void @test.f_agg_tiny(i32 %0) #0 { +entry: + %x = alloca %Tiny, align 1 + store i32 %0, ptr %x, align 1 + %1 = getelementptr inbounds %Tiny, ptr %x, i32 0, i32 0 + %2 = load i8, ptr %1, align 1 + %3 = getelementptr inbounds %Tiny, ptr %x, i32 0, i32 1 + %4 = load i8, ptr %3, align 1 + %add = add i8 %2, %4 + store i8 %add, ptr %1, align 1 + %5 = getelementptr inbounds %Tiny, ptr %x, i32 0, i32 2 + %6 = load i8, ptr %5, align 1 + %7 = getelementptr inbounds %Tiny, ptr %x, i32 0, i32 3 + %8 = load i8, ptr %7, align 1 + %add1 = add i8 %6, %8 + store i8 %add1, ptr %5, align 1 + ret void +} +; Function Attrs: nounwind +define i32 @test.f_agg_tiny_ret() #0 { +entry: + %literal = alloca %Tiny, align 1 + call void @llvm.memcpy.p0.p0.i32(ptr align 1 %literal, ptr align 1 @.__const, i32 4, i1 false) + %0 = load i32, ptr %literal, align 1 + ret i32 %0 +} +; Function Attrs: nounwind +define void @test.f_vec_tiny_v4i8(i32 %0) #0 { +entry: + %x = alloca <4 x i8>, align 4 + store i32 %0, ptr %x, align 4 + %1 = load <4 x i8>, ptr %x, align 4 + %2 = load <4 x i8>, ptr %x, align 4 + %3 = extractelement <4 x i8> %2, i32 1 + %elemset = insertelement <4 x i8> %1, i8 %3, i32 0 + store <4 x i8> %elemset, ptr %x, align 4 + %4 = load <4 x i8>, ptr %x, align 4 + %5 = load <4 x i8>, ptr %x, align 4 + %6 = extractelement <4 x i8> %5, i32 3 + %elemset1 = insertelement <4 x i8> %4, i8 %6, i32 2 + store <4 x i8> %elemset1, ptr %x, align 4 + ret void +} +; Function Attrs: nounwind +define i32 @test.f_vec_tiny_v4i8_ret() #0 { +entry: + %taddr = alloca <4 x i8>, align 4 + store <4 x i8> , ptr %taddr, align 4 + %0 = load i32, ptr %taddr, align 4 + ret i32 %0 +} +; Function Attrs: nounwind +define void @test.f_vec_tiny_v1i32(i32 %0) #0 { +entry: + %x = alloca <1 x i32>, align 4 + store i32 %0, ptr %x, align 4 + %1 = load <1 x i32>, ptr %x, align 4 + %elemset = insertelement <1 x i32> %1, i32 114, i32 0 + store <1 x i32> %elemset, ptr %x, align 4 + ret void +} +; Function Attrs: nounwind +define i32 @test.f_vec_tiny_v1i32_ret() #0 { +entry: + %taddr = alloca <1 x i32>, align 4 + store <1 x i32> , ptr %taddr, align 4 + %0 = load i32, ptr %taddr, align 4 + ret i32 %0 +} +; Function Attrs: nounwind +define void @test.f_agg_small([2 x i32] %0) #0 { +entry: + %x = alloca %Small, align 4 + store [2 x i32] %0, ptr %x, align 4 + %1 = getelementptr inbounds %Small, ptr %x, i32 0, i32 0 + %2 = load i32, ptr %1, align 4 + %3 = getelementptr inbounds %Small, ptr %x, i32 0, i32 1 + %4 = load ptr, ptr %3, align 4 + %5 = load i32, ptr %4, align 4 + %add = add i32 %2, %5 + store i32 %add, ptr %1, align 4 + %6 = getelementptr inbounds %Small, ptr %x, i32 0, i32 1 + %7 = getelementptr inbounds %Small, ptr %x, i32 0, i32 0 + store ptr %7, ptr %6, align 4 + ret void +} +; Function Attrs: nounwind +define [2 x i32] @test.f_agg_small_ret() #0 { +entry: + %literal = alloca %Small, align 4 + call void @llvm.memcpy.p0.p0.i32(ptr align 4 %literal, ptr align 4 @.__const.1, i32 8, i1 false) + %0 = load [2 x i32], ptr %literal, align 4 + ret [2 x i32] %0 +} +; Function Attrs: nounwind +define void @test.f_vec_small_v8i8(i64 %0) #0 { +entry: + %x = alloca <8 x i8>, align 8 + store i64 %0, ptr %x, align 8 + %1 = load <8 x i8>, ptr %x, align 8 + %2 = load <8 x i8>, ptr %x, align 8 + %3 = extractelement <8 x i8> %2, i32 7 + %elemset = insertelement <8 x i8> %1, i8 %3, i32 0 + store <8 x i8> %elemset, ptr %x, align 8 + ret void +} +; Function Attrs: nounwind +define i64 @test.f_vec_small_v8i8_ret() #0 { +entry: + %taddr = alloca <8 x i8>, align 8 + store <8 x i8> , ptr %taddr, align 8 + %0 = load i64, ptr %taddr, align 8 + ret i64 %0 +} +; Function Attrs: nounwind +define void @test.f_vec_small_v1i64(i64 %0) #0 { +entry: + %x = alloca <1 x i64>, align 8 + store i64 %0, ptr %x, align 8 + %1 = load <1 x i64>, ptr %x, align 8 + %elemset = insertelement <1 x i64> %1, i64 114, i32 0 + store <1 x i64> %elemset, ptr %x, align 8 + ret void +} +; Function Attrs: nounwind +define i64 @test.f_vec_small_v1i64_ret() #0 { +entry: + %taddr = alloca <1 x i64>, align 8 + store <1 x i64> , ptr %taddr, align 8 + %0 = load i64, ptr %taddr, align 8 + ret i64 %0 +} +; Function Attrs: nounwind +define void @test.f_agg_small_aligned(i64 %0) #0 { +entry: + %x = alloca %Small_aligned, align 8 + store i64 %0, ptr %x, align 8 + %1 = getelementptr inbounds %Small_aligned, ptr %x, i32 0, i32 0 + %2 = load i64, ptr %1, align 8 + %3 = getelementptr inbounds %Small_aligned, ptr %x, i32 0, i32 0 + %4 = load i64, ptr %3, align 8 + %add = add i64 %2, %4 + store i64 %add, ptr %1, align 8 + ret void +} +; Function Attrs: nounwind +define i64 @test.f_agg_small_aligned_ret(i64 %0) #0 { +entry: + %x = alloca %Small_aligned, align 8 + %literal = alloca %Small_aligned, align 8 + store i64 %0, ptr %x, align 8 + call void @llvm.memcpy.p0.p0.i32(ptr align 8 %literal, ptr align 8 @.__const.2, i32 8, i1 false) + %1 = load i64, ptr %literal, align 8 + ret i64 %1 +} +; Function Attrs: nounwind +define void @test.f_agg_large(ptr align 4 %0) #0 { +entry: + %1 = getelementptr inbounds %Large, ptr %0, i32 0, i32 0 + %2 = getelementptr inbounds %Large, ptr %0, i32 0, i32 1 + %3 = load i32, ptr %2, align 4 + %4 = getelementptr inbounds %Large, ptr %0, i32 0, i32 2 + %5 = load i32, ptr %4, align 4 + %add = add i32 %3, %5 + %6 = getelementptr inbounds %Large, ptr %0, i32 0, i32 3 + %7 = load i32, ptr %6, align 4 + %add1 = add i32 %add, %7 + store i32 %add1, ptr %1, align 4 + ret void +} +; Function Attrs: nounwind +define void @test.f_agg_large_ret(ptr noalias sret(%Large) align 4 %0, i32 %1, i8 signext %2) #0 { +entry: + %literal = alloca %Large, align 4 + call void @llvm.memcpy.p0.p0.i32(ptr align 4 %literal, ptr align 4 @.__const.3, i32 16, i1 false) + call void @llvm.memcpy.p0.p0.i32(ptr align 4 %0, ptr align 4 %literal, i32 16, i1 false) + ret void +} +; Function Attrs: nounwind +define void @test.f_vec_large_v16i8(ptr align 16 %0) #0 { +entry: + %1 = load <16 x i8>, ptr %0, align 16 + %2 = load <16 x i8>, ptr %0, align 16 + %3 = extractelement <16 x i8> %2, i32 7 + %elemset = insertelement <16 x i8> %1, i8 %3, i32 0 + store <16 x i8> %elemset, ptr %0, align 16 + ret void +} +; Function Attrs: nounwind +define void @test.f_vec_large_v16i8_ret(ptr noalias sret(<16 x i8>) align 16 %0) #0 { +entry: + store <16 x i8> , ptr %0, align 16 + ret void +} +; Function Attrs: nounwind +define i32 @test.f_scalar_stack_1(i32 %0, [2 x i32] %1, i64 %2, ptr align 4 %3, i8 zeroext %4, i8 signext %5, i8 %6, i8 %7) #0 { +entry: + %a = alloca %Tiny, align 1 + %b = alloca %Small, align 4 + %c = alloca %Small_aligned, align 8 + store i32 %0, ptr %a, align 1 + store [2 x i32] %1, ptr %b, align 4 + store i64 %2, ptr %c, align 8 + %zext = zext i8 %6 to i32 + %sext = sext i8 %7 to i32 + %add = add i32 %zext, %sext + ret i32 %add +} +; Function Attrs: nounwind +define void @test.f_scalar_stack_2(ptr noalias sret(%Large) align 4 %0, i32 %1, i64 %2, i64 %3, fp128 %4, i8 zeroext %5, i8 %6, i8 %7) #0 { +entry: + %literal = alloca %Large, align 4 + %8 = getelementptr inbounds %Large, ptr %literal, i32 0, i32 0 + store i32 %1, ptr %8, align 4 + %9 = getelementptr inbounds %Large, ptr %literal, i32 0, i32 1 + %zext = zext i8 %5 to i32 + store i32 %zext, ptr %9, align 4 + %10 = getelementptr inbounds %Large, ptr %literal, i32 0, i32 2 + %sext = sext i8 %6 to i32 + store i32 %sext, ptr %10, align 4 + %11 = getelementptr inbounds %Large, ptr %literal, i32 0, i32 3 + %zext1 = zext i8 %7 to i32 + store i32 %zext1, ptr %11, align 4 + call void @llvm.memcpy.p0.p0.i32(ptr align 4 %0, ptr align 4 %literal, i32 16, i1 false) + ret void +} +; Function Attrs: nounwind +define fp128 @test.f_scalar_stack_4(i32 %0, i64 %1, i64 %2, fp128 %3, i8 zeroext %4, i8 %5, i8 %6) #0 { +entry: + ret fp128 %3 +} +; Function Attrs: nounwind +define void @test.f_scalar_stack_5(double %0, i64 %1, double %2, i64 %3, i32 %4, i64 %5, float %6, double %7, fp128 %8) #0 { +entry: + ret void +} +; Function Attrs: nounwind +define void @test.f_agg_stack(double %0, i64 %1, double %2, i64 %3, i32 %4, [2 x i32] %5, i64 %6, ptr align 4 %7) #0 { +entry: + %e = alloca %Tiny, align 1 + %f = alloca %Small, align 4 + %g = alloca %Small_aligned, align 8 + store i32 %4, ptr %e, align 1 + store [2 x i32] %5, ptr %f, align 4 + store i64 %6, ptr %g, align 8 + ret void +} +; Function Attrs: nounwind +declare i32 @f_va_callee(i32, ...) #0 +; Function Attrs: nounwind +define void @test.f_va_caller() #0 { +entry: + %literal = alloca %Tiny, align 1 + %literal1 = alloca %Small, align 4 + %literal2 = alloca %Small_aligned, align 8 + %literal3 = alloca %Large, align 4 + %indirectarg = alloca %Large, align 4 + call void @llvm.memcpy.p0.p0.i32(ptr align 1 %literal, ptr align 1 @.__const.4, i32 4, i1 false) + %0 = load i32, ptr %literal, align 1 + call void @llvm.memcpy.p0.p0.i32(ptr align 4 %literal1, ptr align 4 @.__const.5, i32 8, i1 false) + %1 = load [2 x i32], ptr %literal1, align 4 + call void @llvm.memcpy.p0.p0.i32(ptr align 8 %literal2, ptr align 8 @.__const.6, i32 8, i1 false) + %2 = load i64, ptr %literal2, align 8 + call void @llvm.memcpy.p0.p0.i32(ptr align 4 %literal3, ptr align 4 @.__const.7, i32 16, i1 false) + call void @llvm.memcpy.p0.p0.i32(ptr align 4 %indirectarg, ptr align 4 %literal3, i32 16, i1 false) + %3 = call i32 (i32, ...) @f_va_callee(i32 1, i32 2, i32 3, double 4.000000e+00, double 5.000000e+00, i32 %0, [2 x i32] %1, i64 %2, ptr align 4 %indirectarg) + ret void +} diff --git a/test/test_suite/abi/riscv32-ilp32d-abi.c3t b/test/test_suite/abi/riscv32-ilp32d-abi.c3t index 3a80c2e21..3ad91b071 100644 --- a/test/test_suite/abi/riscv32-ilp32d-abi.c3t +++ b/test/test_suite/abi/riscv32-ilp32d-abi.c3t @@ -180,7 +180,7 @@ entry: ret void } - +; Function Attrs: nounwind define void @test.f_double_s_arg(double %0) #0 { entry: %a = alloca %Double_s, align 8 @@ -188,17 +188,16 @@ entry: ret void } - +; Function Attrs: nounwind define double @test.f_ret_double_s() #0 { entry: %literal = alloca %Double_s, align 8 - %0 = getelementptr inbounds %Double_s, ptr %literal, i32 0, i32 0 - store double 1.000000e+00, ptr %0, align 8 - %1 = load double, ptr %literal, align 8 - ret double %1 + call void @llvm.memcpy.p0.p0.i32(ptr align 8 %literal, ptr align 8 @.__const, i32 8, i1 false) + %0 = load double, ptr %literal, align 8 + ret double %0 } - +; Function Attrs: nounwind define void @test.f_double_double_s_arg(double %0, double %1) #0 { entry: %a = alloca %Double_double_s, align 8 @@ -208,23 +207,20 @@ entry: ret void } - +; Function Attrs: nounwind define { double, double } @test.f_ret_double_double_s() #0 { entry: %literal = alloca %Double_double_s, align 8 - %0 = getelementptr inbounds %Double_double_s, ptr %literal, i32 0, i32 0 - store double 1.000000e+00, ptr %0, align 8 - %1 = getelementptr inbounds %Double_double_s, ptr %literal, i32 0, i32 1 - store double 2.000000e+00, ptr %1, align 8 - %2 = load double, ptr %literal, align 8 + call void @llvm.memcpy.p0.p0.i32(ptr align 8 %literal, ptr align 8 @.__const.1, i32 16, i1 false) + %0 = load double, ptr %literal, align 8 %ptroffset = getelementptr inbounds double, ptr %literal, i32 1 - %3 = load double, ptr %literal, align 8 - %4 = insertvalue { double, double } undef, double %2, 0 - %5 = insertvalue { double, double } %4, double %3, 1 - ret { double, double } %5 + %1 = load double, ptr %literal, align 8 + %2 = insertvalue { double, double } undef, double %0, 0 + %3 = insertvalue { double, double } %2, double %1, 1 + ret { double, double } %3 } - +; Function Attrs: nounwind define void @test.f_double_float_s_arg(double %0, float %1) #0 { entry: %a = alloca %Double_float_s, align 8 @@ -234,29 +230,26 @@ entry: ret void } - +; Function Attrs: nounwind define { double, float } @test.f_ret_double_float_s() #0 { entry: %literal = alloca %Double_float_s, align 8 - %0 = getelementptr inbounds %Double_float_s, ptr %literal, i32 0, i32 0 - store double 1.000000e+00, ptr %0, align 8 - %1 = getelementptr inbounds %Double_float_s, ptr %literal, i32 0, i32 1 - store float 2.000000e+00, ptr %1, align 8 - %2 = load double, ptr %literal, align 8 + call void @llvm.memcpy.p0.p0.i32(ptr align 8 %literal, ptr align 8 @.__const.2, i32 16, i1 false) + %0 = load double, ptr %literal, align 8 %ptroffset = getelementptr inbounds float, ptr %literal, i32 2 - %3 = load float, ptr %literal, align 8 - %4 = insertvalue { double, float } undef, double %2, 0 - %5 = insertvalue { double, float } %4, float %3, 1 - ret { double, float } %5 + %1 = load float, ptr %literal, align 8 + %2 = insertvalue { double, float } undef, double %0, 0 + %3 = insertvalue { double, float } %2, float %1, 1 + ret { double, float } %3 } - +; Function Attrs: nounwind define void @test.f_double_double_s_arg_insufficient_fprs(float %0, double %1, double %2, double %3, double %4, double %5, double %6, ptr align 8 %7) #0 { entry: ret void } - +; Function Attrs: nounwind define void @test.f_double_int8_s_arg(double %0, i8 %1) #0 { entry: %a = alloca %Double_int8_s, align 8 @@ -266,23 +259,20 @@ entry: ret void } - +; Function Attrs: nounwind define { double, i8 } @test.f_ret_double_int8_s() #0 { entry: %literal = alloca %Double_int8_s, align 8 - %0 = getelementptr inbounds %Double_int8_s, ptr %literal, i32 0, i32 0 - store double 1.000000e+00, ptr %0, align 8 - %1 = getelementptr inbounds %Double_int8_s, ptr %literal, i32 0, i32 1 - store i8 2, ptr %1, align 8 - %2 = load double, ptr %literal, align 8 + call void @llvm.memcpy.p0.p0.i32(ptr align 8 %literal, ptr align 8 @.__const.3, i32 16, i1 false) + %0 = load double, ptr %literal, align 8 %ptroffset = getelementptr inbounds i8, ptr %literal, i32 8 - %3 = load i8, ptr %literal, align 8 - %4 = insertvalue { double, i8 } undef, double %2, 0 - %5 = insertvalue { double, i8 } %4, i8 %3, 1 - ret { double, i8 } %5 + %1 = load i8, ptr %literal, align 8 + %2 = insertvalue { double, i8 } undef, double %0, 0 + %3 = insertvalue { double, i8 } %2, i8 %1, 1 + ret { double, i8 } %3 } - +; Function Attrs: nounwind define void @test.f_double_uint8_s_arg(double %0, i8 %1) #0 { entry: %a = alloca %Double_uint8_s, align 8 @@ -292,23 +282,20 @@ entry: ret void } - +; Function Attrs: nounwind define { double, i8 } @test.f_ret_double_uint8_s() #0 { entry: %literal = alloca %Double_uint8_s, align 8 - %0 = getelementptr inbounds %Double_uint8_s, ptr %literal, i32 0, i32 0 - store double 1.000000e+00, ptr %0, align 8 - %1 = getelementptr inbounds %Double_uint8_s, ptr %literal, i32 0, i32 1 - store i8 2, ptr %1, align 8 - %2 = load double, ptr %literal, align 8 + call void @llvm.memcpy.p0.p0.i32(ptr align 8 %literal, ptr align 8 @.__const.4, i32 16, i1 false) + %0 = load double, ptr %literal, align 8 %ptroffset = getelementptr inbounds i8, ptr %literal, i32 8 - %3 = load i8, ptr %literal, align 8 - %4 = insertvalue { double, i8 } undef, double %2, 0 - %5 = insertvalue { double, i8 } %4, i8 %3, 1 - ret { double, i8 } %5 + %1 = load i8, ptr %literal, align 8 + %2 = insertvalue { double, i8 } undef, double %0, 0 + %3 = insertvalue { double, i8 } %2, i8 %1, 1 + ret { double, i8 } %3 } - +; Function Attrs: nounwind define void @test.f_double_int32_s_arg(double %0, i32 %1) #0 { entry: %a = alloca %Double_int32_s, align 8 @@ -318,53 +305,47 @@ entry: ret void } - +; Function Attrs: nounwind define { double, i32 } @test.f_ret_double_int32_s() #0 { entry: %literal = alloca %Double_int32_s, align 8 - %0 = getelementptr inbounds %Double_int32_s, ptr %literal, i32 0, i32 0 - store double 1.000000e+00, ptr %0, align 8 - %1 = getelementptr inbounds %Double_int32_s, ptr %literal, i32 0, i32 1 - store i32 2, ptr %1, align 8 - %2 = load double, ptr %literal, align 8 + call void @llvm.memcpy.p0.p0.i32(ptr align 8 %literal, ptr align 8 @.__const.5, i32 16, i1 false) + %0 = load double, ptr %literal, align 8 %ptroffset = getelementptr inbounds i32, ptr %literal, i32 2 - %3 = load i32, ptr %literal, align 8 - %4 = insertvalue { double, i32 } undef, double %2, 0 - %5 = insertvalue { double, i32 } %4, i32 %3, 1 - ret { double, i32 } %5 + %1 = load i32, ptr %literal, align 8 + %2 = insertvalue { double, i32 } undef, double %0, 0 + %3 = insertvalue { double, i32 } %2, i32 %1, 1 + ret { double, i32 } %3 } - +; Function Attrs: nounwind define void @test.f_double_int64_s_arg(ptr align 8 %0) #0 { entry: ret void } - +; Function Attrs: nounwind define void @test.f_ret_double_int64_s(ptr noalias sret(%Double_int64_s) align 8 %0) #0 { entry: %literal = alloca %Double_int64_s, align 8 - %1 = getelementptr inbounds %Double_int64_s, ptr %literal, i32 0, i32 0 - store double 1.000000e+00, ptr %1, align 8 - %2 = getelementptr inbounds %Double_int64_s, ptr %literal, i32 0, i32 1 - store i64 2, ptr %2, align 8 + call void @llvm.memcpy.p0.p0.i32(ptr align 8 %literal, ptr align 8 @.__const.6, i32 16, i1 false) call void @llvm.memcpy.p0.p0.i32(ptr align 8 %0, ptr align 8 %literal, i32 16, i1 false) ret void } - +; Function Attrs: nounwind define void @test.f_double_int8_s_arg_insufficient_gprs(i32 %0, i32 %1, i32 %2, i32 %3, i32 %4, i32 %5, i32 %6, i32 %7, ptr align 8 %8) #0 { entry: ret void } - +; Function Attrs: nounwind define void @test.f_struct_double_int8_insufficient_fprs(float %0, double %1, double %2, double %3, double %4, double %5, double %6, double %7, ptr align 8 %8) #0 { entry: ret void } - +; Function Attrs: nounwind define void @test.f_doublearr1_s_arg(double %0) #0 { entry: %a = alloca %Doublearr1_s, align 8 @@ -372,18 +353,16 @@ entry: ret void } - +; Function Attrs: nounwind define double @test.f_ret_doublearr1_s() #0 { entry: %literal = alloca %Doublearr1_s, align 8 - %0 = getelementptr inbounds %Doublearr1_s, ptr %literal, i32 0, i32 0 - %1 = getelementptr inbounds [1 x double], ptr %0, i32 0, i32 0 - store double 1.000000e+00, ptr %1, align 8 - %2 = load double, ptr %literal, align 8 - ret double %2 + call void @llvm.memcpy.p0.p0.i32(ptr align 8 %literal, ptr align 8 @.__const.7, i32 8, i1 false) + %0 = load double, ptr %literal, align 8 + ret double %0 } - +; Function Attrs: nounwind define void @test.f_doublearr2_s_arg(double %0, double %1) #0 { entry: %a = alloca %Doublearr2_s, align 8 @@ -393,24 +372,20 @@ entry: ret void } - +; Function Attrs: nounwind define { double, double } @test.f_ret_doublearr2_s() #0 { entry: %literal = alloca %Doublearr2_s, align 8 - %0 = getelementptr inbounds %Doublearr2_s, ptr %literal, i32 0, i32 0 - %1 = getelementptr inbounds [2 x double], ptr %0, i32 0, i32 0 - store double 1.000000e+00, ptr %1, align 8 - %2 = getelementptr inbounds [2 x double], ptr %0, i32 0, i32 1 - store double 2.000000e+00, ptr %2, align 8 - %3 = load double, ptr %literal, align 8 + call void @llvm.memcpy.p0.p0.i32(ptr align 8 %literal, ptr align 8 @.__const.8, i32 16, i1 false) + %0 = load double, ptr %literal, align 8 %ptroffset = getelementptr inbounds double, ptr %literal, i32 1 - %4 = load double, ptr %literal, align 8 - %5 = insertvalue { double, double } undef, double %3, 0 - %6 = insertvalue { double, double } %5, double %4, 1 - ret { double, double } %6 + %1 = load double, ptr %literal, align 8 + %2 = insertvalue { double, double } undef, double %0, 0 + %3 = insertvalue { double, double } %2, double %1, 1 + ret { double, double } %3 } - +; Function Attrs: nounwind define void @test.f_doublearr2_tricky1_s_arg(double %0, double %1) #0 { entry: %a = alloca %Doublearr2_tricky1_s, align 8 @@ -420,86 +395,65 @@ entry: ret void } - +; Function Attrs: nounwind define { double, double } @test.f_ret_doublearr2_tricky1_s() #0 { entry: %literal = alloca %Doublearr2_tricky1_s, align 8 - %0 = getelementptr inbounds %Doublearr2_tricky1_s, ptr %literal, i32 0, i32 0 - %1 = getelementptr inbounds [2 x %Inner], ptr %0, i32 0, i32 0 - %2 = getelementptr inbounds %Inner, ptr %1, i32 0, i32 0 - %3 = getelementptr inbounds [1 x double], ptr %2, i32 0, i32 0 - store double 1.000000e+00, ptr %3, align 8 - %4 = getelementptr inbounds [2 x %Inner], ptr %0, i32 0, i32 1 - %5 = getelementptr inbounds %Inner, ptr %4, i32 0, i32 0 - %6 = getelementptr inbounds [1 x double], ptr %5, i32 0, i32 0 - store double 2.000000e+00, ptr %6, align 8 - %7 = load double, ptr %literal, align 8 + call void @llvm.memcpy.p0.p0.i32(ptr align 8 %literal, ptr align 8 @.__const.9, i32 16, i1 false) + %0 = load double, ptr %literal, align 8 %ptroffset = getelementptr inbounds double, ptr %literal, i32 1 - %8 = load double, ptr %literal, align 8 - %9 = insertvalue { double, double } undef, double %7, 0 - %10 = insertvalue { double, double } %9, double %8, 1 - ret { double, double } %10 + %1 = load double, ptr %literal, align 8 + %2 = insertvalue { double, double } undef, double %0, 0 + %3 = insertvalue { double, double } %2, double %1, 1 + ret { double, double } %3 } - +; Function Attrs: nounwind define void @test.f_int_double_int_s_arg(ptr align 8 %0) #0 { entry: ret void } - +; Function Attrs: nounwind define void @test.f_ret_int_double_int_s(ptr noalias sret(%Int_double_int_s) align 8 %0) #0 { entry: %literal = alloca %Int_double_int_s, align 8 - %1 = getelementptr inbounds %Int_double_int_s, ptr %literal, i32 0, i32 0 - store i32 1, ptr %1, align 8 - %2 = getelementptr inbounds %Int_double_int_s, ptr %literal, i32 0, i32 1 - store double 2.000000e+00, ptr %2, align 8 - %3 = getelementptr inbounds %Int_double_int_s, ptr %literal, i32 0, i32 2 - store i32 3, ptr %3, align 8 + call void @llvm.memcpy.p0.p0.i32(ptr align 8 %literal, ptr align 8 @.__const.10, i32 24, i1 false) call void @llvm.memcpy.p0.p0.i32(ptr align 8 %0, ptr align 8 %literal, i32 24, i1 false) ret void } - +; Function Attrs: nounwind define void @test.f_int64_double_s_arg(ptr align 8 %0) #0 { entry: ret void } - +; Function Attrs: nounwind define void @test.f_ret_int64_double_s(ptr noalias sret(%Int64_double_s) align 8 %0) #0 { entry: %literal = alloca %Int64_double_s, align 8 - %1 = getelementptr inbounds %Int64_double_s, ptr %literal, i32 0, i32 0 - store i64 1, ptr %1, align 8 - %2 = getelementptr inbounds %Int64_double_s, ptr %literal, i32 0, i32 1 - store double 2.000000e+00, ptr %2, align 8 + call void @llvm.memcpy.p0.p0.i32(ptr align 8 %literal, ptr align 8 @.__const.11, i32 16, i1 false) call void @llvm.memcpy.p0.p0.i32(ptr align 8 %0, ptr align 8 %literal, i32 16, i1 false) ret void } - +; Function Attrs: nounwind define void @test.f_char_char_double_s_arg(ptr align 8 %0) #0 { entry: ret void } - +; Function Attrs: nounwind define void @test.f_ret_char_char_double_s(ptr noalias sret(%Char_char_double_s) align 8 %0) #0 { entry: %literal = alloca %Char_char_double_s, align 8 - %1 = getelementptr inbounds %Char_char_double_s, ptr %literal, i32 0, i32 0 - store i8 1, ptr %1, align 8 - %2 = getelementptr inbounds %Char_char_double_s, ptr %literal, i32 0, i32 1 - store i8 2, ptr %2, align 1 - %3 = getelementptr inbounds %Char_char_double_s, ptr %literal, i32 0, i32 2 - store double 3.000000e+00, ptr %3, align 8 + call void @llvm.memcpy.p0.p0.i32(ptr align 8 %literal, ptr align 8 @.__const.12, i32 16, i1 false) call void @llvm.memcpy.p0.p0.i32(ptr align 8 %0, ptr align 8 %literal, i32 16, i1 false) ret void } - +; Function Attrs: nounwind define void @test.f_double_u_arg(i64 %0) #0 { entry: %a = alloca %Double_u, align 8 @@ -507,16 +461,16 @@ entry: ret void } - +; Function Attrs: nounwind define i64 @test.f_ret_double_u() #0 { entry: %literal = alloca %Double_u, align 8 - store double 1.000000e+00, ptr %literal, align 8 + call void @llvm.memcpy.p0.p0.i32(ptr align 8 %literal, ptr align 8 @.__const.13, i32 8, i1 false) %0 = load i64, ptr %literal, align 8 ret i64 %0 } - +; Function Attrs: nounwind define { double, i32 } @test.f_ret_double_int32_s_double_int32_s_just_sufficient_gprs(i32 %0, i32 %1, i32 %2, i32 %3, i32 %4, i32 %5, i32 %6, double %7, i32 %8) #0 { entry: %h = alloca %Double_int32_s, align 8 @@ -524,19 +478,16 @@ entry: store double %7, ptr %h, align 8 %ptroffset = getelementptr inbounds i32, ptr %h, i32 2 store i32 %8, ptr %h, align 8 - %9 = getelementptr inbounds %Double_int32_s, ptr %literal, i32 0, i32 0 - store double 1.000000e+00, ptr %9, align 8 - %10 = getelementptr inbounds %Double_int32_s, ptr %literal, i32 0, i32 1 - store i32 2, ptr %10, align 8 - %11 = load double, ptr %literal, align 8 + call void @llvm.memcpy.p0.p0.i32(ptr align 8 %literal, ptr align 8 @.__const.14, i32 16, i1 false) + %9 = load double, ptr %literal, align 8 %ptroffset1 = getelementptr inbounds i32, ptr %literal, i32 2 - %12 = load i32, ptr %literal, align 8 - %13 = insertvalue { double, i32 } undef, double %11, 0 - %14 = insertvalue { double, i32 } %13, i32 %12, 1 - ret { double, i32 } %14 + %10 = load i32, ptr %literal, align 8 + %11 = insertvalue { double, i32 } undef, double %9, 0 + %12 = insertvalue { double, i32 } %11, i32 %10, 1 + ret { double, i32 } %12 } - +; Function Attrs: nounwind define { double, double } @test.f_ret_double_double_s_double_int32_s_just_sufficient_gprs(i32 %0, i32 %1, i32 %2, i32 %3, i32 %4, i32 %5, i32 %6, double %7, i32 %8) #0 { entry: %h = alloca %Double_int32_s, align 8 @@ -544,14 +495,11 @@ entry: store double %7, ptr %h, align 8 %ptroffset = getelementptr inbounds i32, ptr %h, i32 2 store i32 %8, ptr %h, align 8 - %9 = getelementptr inbounds %Double_double_s, ptr %literal, i32 0, i32 0 - store double 1.000000e+00, ptr %9, align 8 - %10 = getelementptr inbounds %Double_double_s, ptr %literal, i32 0, i32 1 - store double 2.000000e+00, ptr %10, align 8 - %11 = load double, ptr %literal, align 8 + call void @llvm.memcpy.p0.p0.i32(ptr align 8 %literal, ptr align 8 @.__const.15, i32 16, i1 false) + %9 = load double, ptr %literal, align 8 %ptroffset1 = getelementptr inbounds double, ptr %literal, i32 1 - %12 = load double, ptr %literal, align 8 - %13 = insertvalue { double, double } undef, double %11, 0 - %14 = insertvalue { double, double } %13, double %12, 1 - ret { double, double } %14 + %10 = load double, ptr %literal, align 8 + %11 = insertvalue { double, double } undef, double %9, 0 + %12 = insertvalue { double, double } %11, double %10, 1 + ret { double, double } %12 } diff --git a/test/test_suite/abi/riscv32-ilp32f-abi.c3t b/test/test_suite/abi/riscv32-ilp32f-abi.c3t index c2f35874d..c0295a133 100644 --- a/test/test_suite/abi/riscv32-ilp32f-abi.c3t +++ b/test/test_suite/abi/riscv32-ilp32f-abi.c3t @@ -40,7 +40,7 @@ entry: ret void } - +; Function Attrs: nounwind define void @test.f_double_s_arg(i64 %0) #0 { entry: %a = alloca %Double_s, align 8 @@ -48,48 +48,41 @@ entry: ret void } - +; Function Attrs: nounwind define i64 @test.f_ret_double_s() #0 { entry: %literal = alloca %Double_s, align 8 - %0 = getelementptr inbounds %Double_s, ptr %literal, i32 0, i32 0 - store double 1.000000e+00, ptr %0, align 8 - %1 = load i64, ptr %literal, align 8 - ret i64 %1 + call void @llvm.memcpy.p0.p0.i32(ptr align 8 %literal, ptr align 8 @.__const, i32 8, i1 false) + %0 = load i64, ptr %literal, align 8 + ret i64 %0 } - +; Function Attrs: nounwind define void @test.f_double_double_s_arg(ptr align 8 %0) #0 { entry: ret void } - +; Function Attrs: nounwind define void @test.f_ret_double_double_s(ptr noalias sret(%Double_double_s) align 8 %0) #0 { entry: %literal = alloca %Double_double_s, align 8 - %1 = getelementptr inbounds %Double_double_s, ptr %literal, i32 0, i32 0 - store double 1.000000e+00, ptr %1, align 8 - %2 = getelementptr inbounds %Double_double_s, ptr %literal, i32 0, i32 1 - store double 2.000000e+00, ptr %2, align 8 + call void @llvm.memcpy.p0.p0.i32(ptr align 8 %literal, ptr align 8 @.__const.1, i32 16, i1 false) call void @llvm.memcpy.p0.p0.i32(ptr align 8 %0, ptr align 8 %literal, i32 16, i1 false) ret void } - +; Function Attrs: nounwind define void @test.f_int_double_s_arg(ptr align 8 %0) #0 { entry: ret void } - +; Function Attrs: nounwind define void @test.f_ret_int_double_s(ptr noalias sret(%Int_double_s) align 8 %0) #0 { entry: %literal = alloca %Int_double_s, align 8 - %1 = getelementptr inbounds %Int_double_s, ptr %literal, i32 0, i32 0 - store i32 1, ptr %1, align 8 - %2 = getelementptr inbounds %Int_double_s, ptr %literal, i32 0, i32 1 - store double 2.000000e+00, ptr %2, align 8 + call void @llvm.memcpy.p0.p0.i32(ptr align 8 %literal, ptr align 8 @.__const.2, i32 16, i1 false) call void @llvm.memcpy.p0.p0.i32(ptr align 8 %0, ptr align 8 %literal, i32 16, i1 false) ret void } diff --git a/test/test_suite/abi/riscv32-ilp32f-ilp32d-abi-2.c3t b/test/test_suite/abi/riscv32-ilp32f-ilp32d-abi-2.c3t index d45407b98..c21cd6d41 100644 --- a/test/test_suite/abi/riscv32-ilp32f-ilp32d-abi-2.c3t +++ b/test/test_suite/abi/riscv32-ilp32f-ilp32d-abi-2.c3t @@ -168,10 +168,9 @@ entry: define float @test.f_ret_float_s() #0 { entry: %literal = alloca %Float_s, align 4 - %0 = getelementptr inbounds %Float_s, ptr %literal, i32 0, i32 0 - store float 1.000000e+00, ptr %0, align 4 - %1 = load float, ptr %literal, align 4 - ret float %1 + call void @llvm.memcpy.p0.p0.i32(ptr align 4 %literal, ptr align 4 @.__const, i32 4, i1 false) + %0 = load float, ptr %literal, align 4 + ret float %0 } define void @test.f_float_float_s_arg(float %0, float %1) #0 { @@ -186,18 +185,16 @@ entry: define { float, float } @test.f_ret_float_float_s() #0 { entry: %literal = alloca %Float_float_s, align 4 - %0 = getelementptr inbounds %Float_float_s, ptr %literal, i32 0, i32 0 - store float 1.000000e+00, ptr %0, align 4 - %1 = getelementptr inbounds %Float_float_s, ptr %literal, i32 0, i32 1 - store float 2.000000e+00, ptr %1, align 4 - %2 = load float, ptr %literal, align 4 + call void @llvm.memcpy.p0.p0.i32(ptr align 4 %literal, ptr align 4 @.__const.1, i32 8, i1 false) + %0 = load float, ptr %literal, align 4 %ptroffset = getelementptr inbounds float, ptr %literal, i32 1 - %3 = load float, ptr %literal, align 4 - %4 = insertvalue { float, float } undef, float %2, 0 - %5 = insertvalue { float, float } %4, float %3, 1 - ret { float, float } %5 + %1 = load float, ptr %literal, align 4 + %2 = insertvalue { float, float } undef, float %0, 0 + %3 = insertvalue { float, float } %2, float %1, 1 + ret { float, float } %3 } +; Function Attrs: nounwind define void @test.f_float_float_s_arg_insufficient_fprs(float %0, float %1, float %2, float %3, float %4, float %5, float %6, [2 x i32] %7) #0 { entry: %h = alloca %Float_float_s, align 4 @@ -205,6 +202,7 @@ entry: ret void } +; Function Attrs: nounwind define void @test.f_float_int8_s_arg(float %0, i8 %1) #0 { entry: %a = alloca %Float_int8_s, align 4 @@ -214,21 +212,20 @@ entry: ret void } +; Function Attrs: nounwind define { float, i8 } @test.f_ret_float_int8_s() #0 { entry: %literal = alloca %Float_int8_s, align 4 - %0 = getelementptr inbounds %Float_int8_s, ptr %literal, i32 0, i32 0 - store float 1.000000e+00, ptr %0, align 4 - %1 = getelementptr inbounds %Float_int8_s, ptr %literal, i32 0, i32 1 - store i8 2, ptr %1, align 4 - %2 = load float, ptr %literal, align 4 + call void @llvm.memcpy.p0.p0.i32(ptr align 4 %literal, ptr align 4 @.__const.2, i32 8, i1 false) + %0 = load float, ptr %literal, align 4 %ptroffset = getelementptr inbounds i8, ptr %literal, i32 4 - %3 = load i8, ptr %literal, align 4 - %4 = insertvalue { float, i8 } undef, float %2, 0 - %5 = insertvalue { float, i8 } %4, i8 %3, 1 - ret { float, i8 } %5 + %1 = load i8, ptr %literal, align 4 + %2 = insertvalue { float, i8 } undef, float %0, 0 + %3 = insertvalue { float, i8 } %2, i8 %1, 1 + ret { float, i8 } %3 } +; Function Attrs: nounwind define void @test.f_float_uint8_s_arg(float %0, i8 %1) #0 { entry: %a = alloca %Float_uint8_s, align 4 @@ -238,21 +235,20 @@ entry: ret void } +; Function Attrs: nounwind define { float, i8 } @test.f_ret_float_uint8_s() #0 { entry: %literal = alloca %Float_uint8_s, align 4 - %0 = getelementptr inbounds %Float_uint8_s, ptr %literal, i32 0, i32 0 - store float 1.000000e+00, ptr %0, align 4 - %1 = getelementptr inbounds %Float_uint8_s, ptr %literal, i32 0, i32 1 - store i8 2, ptr %1, align 4 - %2 = load float, ptr %literal, align 4 + call void @llvm.memcpy.p0.p0.i32(ptr align 4 %literal, ptr align 4 @.__const.3, i32 8, i1 false) + %0 = load float, ptr %literal, align 4 %ptroffset = getelementptr inbounds i8, ptr %literal, i32 4 - %3 = load i8, ptr %literal, align 4 - %4 = insertvalue { float, i8 } undef, float %2, 0 - %5 = insertvalue { float, i8 } %4, i8 %3, 1 - ret { float, i8 } %5 + %1 = load i8, ptr %literal, align 4 + %2 = insertvalue { float, i8 } undef, float %0, 0 + %3 = insertvalue { float, i8 } %2, i8 %1, 1 + ret { float, i8 } %3 } +; Function Attrs: nounwind define void @test.f_float_int32_s_arg(float %0, i32 %1) #0 { entry: %a = alloca %Float_int32_s, align 4 @@ -262,37 +258,35 @@ entry: ret void } +; Function Attrs: nounwind define { float, i32 } @test.f_ret_float_int32_s() #0 { entry: %literal = alloca %Float_int32_s, align 4 - %0 = getelementptr inbounds %Float_int32_s, ptr %literal, i32 0, i32 0 - store float 1.000000e+00, ptr %0, align 4 - %1 = getelementptr inbounds %Float_int32_s, ptr %literal, i32 0, i32 1 - store i32 2, ptr %1, align 4 - %2 = load float, ptr %literal, align 4 + call void @llvm.memcpy.p0.p0.i32(ptr align 4 %literal, ptr align 4 @.__const.4, i32 8, i1 false) + %0 = load float, ptr %literal, align 4 %ptroffset = getelementptr inbounds i32, ptr %literal, i32 1 - %3 = load i32, ptr %literal, align 4 - %4 = insertvalue { float, i32 } undef, float %2, 0 - %5 = insertvalue { float, i32 } %4, i32 %3, 1 - ret { float, i32 } %5 + %1 = load i32, ptr %literal, align 4 + %2 = insertvalue { float, i32 } undef, float %0, 0 + %3 = insertvalue { float, i32 } %2, i32 %1, 1 + ret { float, i32 } %3 } +; Function Attrs: nounwind define void @test.f_float_int64_s_arg(ptr align 8 %0) #0 { entry: ret void } +; Function Attrs: nounwind define void @test.f_ret_float_int64_s(ptr noalias sret(%Float_int64_s) align 8 %0) #0 { entry: %literal = alloca %Float_int64_s, align 8 - %1 = getelementptr inbounds %Float_int64_s, ptr %literal, i32 0, i32 0 - store float 1.000000e+00, ptr %1, align 8 - %2 = getelementptr inbounds %Float_int64_s, ptr %literal, i32 0, i32 1 - store i64 2, ptr %2, align 8 + call void @llvm.memcpy.p0.p0.i32(ptr align 8 %literal, ptr align 8 @.__const.5, i32 16, i1 false) call void @llvm.memcpy.p0.p0.i32(ptr align 8 %0, ptr align 8 %literal, i32 16, i1 false) ret void } +; Function Attrs: nounwind define void @test.f_float_int8_s_arg_insufficient_gprs(i32 %0, i32 %1, i32 %2, i32 %3, i32 %4, i32 %5, i32 %6, i32 %7, [2 x i32] %8) #0 { entry: %i = alloca %Float_int8_s, align 4 @@ -300,6 +294,7 @@ entry: ret void } +; Function Attrs: nounwind define void @test.f_struct_float_int8_insufficient_fprs(float %0, float %1, float %2, float %3, float %4, float %5, float %6, float %7, [2 x i32] %8) #0 { entry: %i = alloca %Float_int8_s, align 4 @@ -307,6 +302,7 @@ entry: ret void } +; Function Attrs: nounwind define void @test.f_floatarr1_s_arg(float %0) #0 { entry: %a = alloca %Floatarr1_s, align 4 @@ -314,16 +310,16 @@ entry: ret void } +; Function Attrs: nounwind define float @test.f_ret_floatarr1_s() #0 { entry: %literal = alloca %Floatarr1_s, align 4 - %0 = getelementptr inbounds %Floatarr1_s, ptr %literal, i32 0, i32 0 - %1 = getelementptr inbounds [1 x float], ptr %0, i32 0, i32 0 - store float 1.000000e+00, ptr %1, align 4 - %2 = load float, ptr %literal, align 4 - ret float %2 + call void @llvm.memcpy.p0.p0.i32(ptr align 4 %literal, ptr align 4 @.__const.6, i32 4, i1 false) + %0 = load float, ptr %literal, align 4 + ret float %0 } +; Function Attrs: nounwind define void @test.f_floatarr2_s_arg(float %0, float %1) #0 { entry: %a = alloca %Floatarr2_s, align 4 @@ -333,22 +329,20 @@ entry: ret void } +; Function Attrs: nounwind define { float, float } @test.f_ret_floatarr2_s() #0 { entry: %literal = alloca %Floatarr2_s, align 4 - %0 = getelementptr inbounds %Floatarr2_s, ptr %literal, i32 0, i32 0 - %1 = getelementptr inbounds [2 x float], ptr %0, i32 0, i32 0 - store float 1.000000e+00, ptr %1, align 4 - %2 = getelementptr inbounds [2 x float], ptr %0, i32 0, i32 1 - store float 2.000000e+00, ptr %2, align 4 - %3 = load float, ptr %literal, align 4 + call void @llvm.memcpy.p0.p0.i32(ptr align 4 %literal, ptr align 4 @.__const.7, i32 8, i1 false) + %0 = load float, ptr %literal, align 4 %ptroffset = getelementptr inbounds float, ptr %literal, i32 1 - %4 = load float, ptr %literal, align 4 - %5 = insertvalue { float, float } undef, float %3, 0 - %6 = insertvalue { float, float } %5, float %4, 1 - ret { float, float } %6 + %1 = load float, ptr %literal, align 4 + %2 = insertvalue { float, float } undef, float %0, 0 + %3 = insertvalue { float, float } %2, float %1, 1 + ret { float, float } %3 } +; Function Attrs: nounwind define void @test.f_floatarr2_tricky1_s_arg(float %0, float %1) #0 { entry: %a = alloca %Floatarr2_tricky1_s, align 4 @@ -358,60 +352,50 @@ entry: ret void } +; Function Attrs: nounwind define { float, float } @test.f_ret_floatarr2_tricky1_s() #0 { entry: %literal = alloca %Floatarr2_tricky1_s, align 4 - %0 = getelementptr inbounds %Floatarr2_tricky1_s, ptr %literal, i32 0, i32 0 - %1 = getelementptr inbounds [2 x %Inner], ptr %0, i32 0, i32 0 - %2 = getelementptr inbounds %Inner, ptr %1, i32 0, i32 0 - %3 = getelementptr inbounds [1 x float], ptr %2, i32 0, i32 0 - store float 1.000000e+00, ptr %3, align 4 - %4 = getelementptr inbounds [2 x %Inner], ptr %0, i32 0, i32 1 - %5 = getelementptr inbounds %Inner, ptr %4, i32 0, i32 0 - %6 = getelementptr inbounds [1 x float], ptr %5, i32 0, i32 0 - store float 2.000000e+00, ptr %6, align 4 - %7 = load float, ptr %literal, align 4 + call void @llvm.memcpy.p0.p0.i32(ptr align 4 %literal, ptr align 4 @.__const.8, i32 8, i1 false) + %0 = load float, ptr %literal, align 4 %ptroffset = getelementptr inbounds float, ptr %literal, i32 1 - %8 = load float, ptr %literal, align 4 - %9 = insertvalue { float, float } undef, float %7, 0 - %10 = insertvalue { float, float } %9, float %8, 1 - ret { float, float } %10 + %1 = load float, ptr %literal, align 4 + %2 = insertvalue { float, float } undef, float %0, 0 + %3 = insertvalue { float, float } %2, float %1, 1 + ret { float, float } %3 } +; Function Attrs: nounwind define void @test.f_int_float_int_s_arg(ptr align 4 %0) #0 { entry: ret void } +; Function Attrs: nounwind define void @test.f_ret_int_float_int_s(ptr noalias sret(%Int_float_int_s) align 4 %0) #0 { entry: %literal = alloca %Int_float_int_s, align 4 - %1 = getelementptr inbounds %Int_float_int_s, ptr %literal, i32 0, i32 0 - store i32 1, ptr %1, align 4 - %2 = getelementptr inbounds %Int_float_int_s, ptr %literal, i32 0, i32 1 - store float 2.000000e+00, ptr %2, align 4 - %3 = getelementptr inbounds %Int_float_int_s, ptr %literal, i32 0, i32 2 - store i32 3, ptr %3, align 4 + call void @llvm.memcpy.p0.p0.i32(ptr align 4 %literal, ptr align 4 @.__const.9, i32 12, i1 false) call void @llvm.memcpy.p0.p0.i32(ptr align 4 %0, ptr align 4 %literal, i32 12, i1 false) ret void } +; Function Attrs: nounwind define void @test.f_int64_float_s_arg(ptr align 8 %0) #0 { entry: ret void } +; Function Attrs: nounwind define void @test.f_ret_int64_float_s(ptr noalias sret(%Int64_float_s) align 8 %0) #0 { entry: %literal = alloca %Int64_float_s, align 8 - %1 = getelementptr inbounds %Int64_float_s, ptr %literal, i32 0, i32 0 - store i64 1, ptr %1, align 8 - %2 = getelementptr inbounds %Int64_float_s, ptr %literal, i32 0, i32 1 - store float 2.000000e+00, ptr %2, align 8 + call void @llvm.memcpy.p0.p0.i32(ptr align 8 %literal, ptr align 8 @.__const.10, i32 16, i1 false) call void @llvm.memcpy.p0.p0.i32(ptr align 8 %0, ptr align 8 %literal, i32 16, i1 false) ret void } +; Function Attrs: nounwind define void @test.f_char_char_float_s_arg([2 x i32] %0) #0 { entry: %a = alloca %Char_char_float_s, align 4 @@ -419,19 +403,16 @@ entry: ret void } +; Function Attrs: nounwind define [2 x i32] @test.f_ret_char_char_float_s() #0 { entry: %literal = alloca %Char_char_float_s, align 4 - %0 = getelementptr inbounds %Char_char_float_s, ptr %literal, i32 0, i32 0 - store i8 1, ptr %0, align 4 - %1 = getelementptr inbounds %Char_char_float_s, ptr %literal, i32 0, i32 1 - store i8 2, ptr %1, align 1 - %2 = getelementptr inbounds %Char_char_float_s, ptr %literal, i32 0, i32 2 - store float 3.000000e+00, ptr %2, align 4 - %3 = load [2 x i32], ptr %literal, align 4 - ret [2 x i32] %3 + call void @llvm.memcpy.p0.p0.i32(ptr align 4 %literal, ptr align 4 @.__const.11, i32 8, i1 false) + %0 = load [2 x i32], ptr %literal, align 4 + ret [2 x i32] %0 } +; Function Attrs: nounwind define void @test.f_float_u_arg(i32 %0) #0 { entry: %a = alloca %Float_u, align 4 @@ -439,10 +420,11 @@ entry: ret void } +; Function Attrs: nounwind define i32 @test.f_ret_float_u() #0 { entry: %literal = alloca %Float_u, align 4 - store float 1.000000e+00, ptr %literal, align 4 + call void @llvm.memcpy.p0.p0.i32(ptr align 4 %literal, ptr align 4 @.__const.12, i32 4, i1 false) %0 = load i32, ptr %literal, align 4 ret i32 %0 } diff --git a/test/test_suite/abi/riscv64-lp64-lp64f-lp64d-abi-1.c3t b/test/test_suite/abi/riscv64-lp64-lp64f-lp64d-abi-1.c3t index 9409e756d..bbc361eff 100644 --- a/test/test_suite/abi/riscv64-lp64-lp64f-lp64d-abi-1.c3t +++ b/test/test_suite/abi/riscv64-lp64-lp64f-lp64d-abi-1.c3t @@ -194,13 +194,13 @@ define signext i32 @test.f_scalar_stack_2(i32 signext %0, i128 %1, i64 %2, fp128 define void @test.f_scalar_stack_3(ptr noalias sret(%Large) align 8 %0, i32 signext %1, i128 %2, fp128 %3, ptr align 32 %4, i8 zeroext %5, i8 %6, i8 %7) declare signext i32 @f_va_callee(i32 signext, ...) call void @llvm.memcpy.p0.p0.i32(ptr align 8 %indirectarg, ptr align 8 %literal3, i32 32, i1 false) -call i32 (i32, ...) @f_va_callee(i32 signext 1, i32 signext 2, i64 3, double 4.000000e+00, double 5.000000e+00, i64 %4, [2 x i64] %7, i128 %9, ptr align 8 %indirectarg) -call i32 (i32, ...) @f_va_callee(i32 signext 1, i32 signext 2, i32 signext 3, i32 signext 4, fp128 %15, i32 signext 6, i32 signext 7, i32 8, i32 9) -call i32 (i32, ...) @f_va_callee(i32 signext 1, i32 signext 2, i32 signext 3, i32 signext 4, i128 %18, i32 signext 6, i32 signext 7, i32 8, i32 9) -call i32 (i32, ...) @f_va_callee(i32 signext 1, i32 signext 2, i32 signext 3, i32 signext 4, [2 x i64] %22, i32 signext 6, i32 signext 7, i32 8, i32 9) -call i32 (i32, ...) @f_va_callee(i32 signext 1, i32 signext 2, i32 signext 3, i32 signext 4, i32 signext 5, fp128 %24, i32 7, i32 8, i32 9) -call i32 (i32, ...) @f_va_callee(i32 signext 1, i32 signext 2, i32 signext 3, i32 signext 4, i32 signext 5, i128 %27, i32 7, i32 8, i32 9) -call i32 (i32, ...) @f_va_callee(i32 signext 1, i32 signext 2, i32 signext 3, i32 signext 4, i32 signext 5, [2 x i64] %31, i32 signext 7, i32 8, i32 9) -call i32 (i32, ...) @f_va_callee(i32 signext 1, i32 signext 2, i32 signext 3, i32 signext 4, i32 signext 5, i32 signext 6, fp128 %33, i32 8, i32 9) -call i32 (i32, ...) @f_va_callee(i32 signext 1, i32 signext 2, i32 signext 3, i32 signext 4, i32 signext 5, i32 signext 6, i128 %36, i32 8, i32 9) -call i32 (i32, ...) @f_va_callee(i32 signext 1, i32 signext 2, i32 signext 3, i32 signext 4, i32 signext 5, i32 signext 6, [2 x i64] %40, i32 8, i32 9) \ No newline at end of file + %3 = call i32 (i32, ...) @f_va_callee(i32 signext 1, i32 signext 2, i64 3, double 4.000000e+00, double 5.000000e+00, i64 %0, [2 x i64] %1, i128 %2, ptr align 8 %indirectarg) + %5 = call i32 (i32, ...) @f_va_callee(i32 signext 1, i32 signext 2, i32 signext 3, i32 signext 4, fp128 %4, i32 signext 6, i32 signext 7, i32 8, i32 9) + %7 = call i32 (i32, ...) @f_va_callee(i32 signext 1, i32 signext 2, i32 signext 3, i32 signext 4, i128 %6, i32 signext 6, i32 signext 7, i32 8, i32 9) + %9 = call i32 (i32, ...) @f_va_callee(i32 signext 1, i32 signext 2, i32 signext 3, i32 signext 4, [2 x i64] %8, i32 signext 6, i32 signext 7, i32 8, i32 9) + %11 = call i32 (i32, ...) @f_va_callee(i32 signext 1, i32 signext 2, i32 signext 3, i32 signext 4, i32 signext 5, fp128 %10, i32 7, i32 8, i32 9) + %13 = call i32 (i32, ...) @f_va_callee(i32 signext 1, i32 signext 2, i32 signext 3, i32 signext 4, i32 signext 5, i128 %12, i32 7, i32 8, i32 9) + %15 = call i32 (i32, ...) @f_va_callee(i32 signext 1, i32 signext 2, i32 signext 3, i32 signext 4, i32 signext 5, [2 x i64] %14, i32 signext 7, i32 8, i32 9) + %17 = call i32 (i32, ...) @f_va_callee(i32 signext 1, i32 signext 2, i32 signext 3, i32 signext 4, i32 signext 5, i32 signext 6, fp128 %16, i32 8, i32 9) + %19 = call i32 (i32, ...) @f_va_callee(i32 signext 1, i32 signext 2, i32 signext 3, i32 signext 4, i32 signext 5, i32 signext 6, i128 %18, i32 8, i32 9) + %21 = call i32 (i32, ...) @f_va_callee(i32 signext 1, i32 signext 2, i32 signext 3, i32 signext 4, i32 signext 5, i32 signext 6, [2 x i64] %20, i32 8, i32 9) \ No newline at end of file diff --git a/test/test_suite/abi/riscv64-lp64-lp64f-lp64d-abi-2.c3t b/test/test_suite/abi/riscv64-lp64-lp64f-lp64d-abi-2.c3t index f67bcda4a..73a140278 100644 --- a/test/test_suite/abi/riscv64-lp64-lp64f-lp64d-abi-2.c3t +++ b/test/test_suite/abi/riscv64-lp64-lp64f-lp64d-abi-2.c3t @@ -194,14 +194,14 @@ define signext i32 @test.f_scalar_stack_1(i64 %0, [2 x i64] %1, i128 %2, ptr ali define signext i32 @test.f_scalar_stack_2(i32 signext %0, i128 %1, i64 %2, fp128 %3, ptr align 32 %4, i8 zeroext %5, i8 %6, i8 %7) define void @test.f_scalar_stack_3(ptr noalias sret(%Large) align 8 %0, i32 signext %1, i128 %2, fp128 %3, ptr align 32 %4, i8 zeroext %5, i8 %6, i8 %7) declare signext i32 @f_va_callee(i32 signext, ...) -call void @llvm.memcpy.p0.p0.i32(ptr align 8 %indirectarg, ptr align 8 %literal3, i32 32, i1 false) -call i32 (i32, ...) @f_va_callee(i32 signext 1, i32 signext 2, i64 3, double 4.000000e+00, double 5.000000e+00, i64 %4, [2 x i64] %7, i128 %9, ptr align 8 %indirectarg) -call i32 (i32, ...) @f_va_callee(i32 signext 1, i32 signext 2, i32 signext 3, i32 signext 4, fp128 %15, i32 signext 6, i32 signext 7, i32 8, i32 9) -call i32 (i32, ...) @f_va_callee(i32 signext 1, i32 signext 2, i32 signext 3, i32 signext 4, i128 %18, i32 signext 6, i32 signext 7, i32 8, i32 9) -call i32 (i32, ...) @f_va_callee(i32 signext 1, i32 signext 2, i32 signext 3, i32 signext 4, [2 x i64] %22, i32 signext 6, i32 signext 7, i32 8, i32 9) -call i32 (i32, ...) @f_va_callee(i32 signext 1, i32 signext 2, i32 signext 3, i32 signext 4, i32 signext 5, fp128 %24, i32 7, i32 8, i32 9) -call i32 (i32, ...) @f_va_callee(i32 signext 1, i32 signext 2, i32 signext 3, i32 signext 4, i32 signext 5, i128 %27, i32 7, i32 8, i32 9) -call i32 (i32, ...) @f_va_callee(i32 signext 1, i32 signext 2, i32 signext 3, i32 signext 4, i32 signext 5, [2 x i64] %31, i32 signext 7, i32 8, i32 9) -call i32 (i32, ...) @f_va_callee(i32 signext 1, i32 signext 2, i32 signext 3, i32 signext 4, i32 signext 5, i32 signext 6, fp128 %33, i32 8, i32 9) -call i32 (i32, ...) @f_va_callee(i32 signext 1, i32 signext 2, i32 signext 3, i32 signext 4, i32 signext 5, i32 signext 6, i128 %36, i32 8, i32 9) -call i32 (i32, ...) @f_va_callee(i32 signext 1, i32 signext 2, i32 signext 3, i32 signext 4, i32 signext 5, i32 signext 6, [2 x i64] %40, i32 8, i32 9) \ No newline at end of file + call void @llvm.memcpy.p0.p0.i32(ptr align 8 %indirectarg, ptr align 8 %literal3, i32 32, i1 false) + %3 = call i32 (i32, ...) @f_va_callee(i32 signext 1, i32 signext 2, i64 3, double 4.000000e+00, double 5.000000e+00, i64 %0, [2 x i64] %1, i128 %2, ptr align 8 %indirectarg) + %5 = call i32 (i32, ...) @f_va_callee(i32 signext 1, i32 signext 2, i32 signext 3, i32 signext 4, fp128 %4, i32 signext 6, i32 signext 7, i32 8, i32 9) + %7 = call i32 (i32, ...) @f_va_callee(i32 signext 1, i32 signext 2, i32 signext 3, i32 signext 4, i128 %6, i32 signext 6, i32 signext 7, i32 8, i32 9) + %9 = call i32 (i32, ...) @f_va_callee(i32 signext 1, i32 signext 2, i32 signext 3, i32 signext 4, [2 x i64] %8, i32 signext 6, i32 signext 7, i32 8, i32 9) + %11 = call i32 (i32, ...) @f_va_callee(i32 signext 1, i32 signext 2, i32 signext 3, i32 signext 4, i32 signext 5, fp128 %10, i32 7, i32 8, i32 9) + %13 = call i32 (i32, ...) @f_va_callee(i32 signext 1, i32 signext 2, i32 signext 3, i32 signext 4, i32 signext 5, i128 %12, i32 7, i32 8, i32 9) + %15 = call i32 (i32, ...) @f_va_callee(i32 signext 1, i32 signext 2, i32 signext 3, i32 signext 4, i32 signext 5, [2 x i64] %14, i32 signext 7, i32 8, i32 9) + %17 = call i32 (i32, ...) @f_va_callee(i32 signext 1, i32 signext 2, i32 signext 3, i32 signext 4, i32 signext 5, i32 signext 6, fp128 %16, i32 8, i32 9) + %19 = call i32 (i32, ...) @f_va_callee(i32 signext 1, i32 signext 2, i32 signext 3, i32 signext 4, i32 signext 5, i32 signext 6, i128 %18, i32 8, i32 9) + %21 = call i32 (i32, ...) @f_va_callee(i32 signext 1, i32 signext 2, i32 signext 3, i32 signext 4, i32 signext 5, i32 signext 6, [2 x i64] %20, i32 8, i32 9) diff --git a/test/test_suite/abi/riscv64-lp64-lp64f-lp64d-abi-3.c3t b/test/test_suite/abi/riscv64-lp64-lp64f-lp64d-abi-3.c3t index 05d371b3b..640e25f84 100644 --- a/test/test_suite/abi/riscv64-lp64-lp64f-lp64d-abi-3.c3t +++ b/test/test_suite/abi/riscv64-lp64-lp64f-lp64d-abi-3.c3t @@ -194,14 +194,14 @@ define signext i32 @test.f_scalar_stack_1(i64 %0, [2 x i64] %1, i128 %2, ptr ali define signext i32 @test.f_scalar_stack_2(i32 signext %0, i128 %1, i64 %2, fp128 %3, ptr align 32 %4, i8 zeroext %5, i8 %6, i8 %7) define void @test.f_scalar_stack_3(ptr noalias sret(%Large) align 8 %0, i32 signext %1, i128 %2, fp128 %3, ptr align 32 %4, i8 zeroext %5, i8 %6, i8 %7) declare signext i32 @f_va_callee(i32 signext, ...) -call void @llvm.memcpy.p0.p0.i32(ptr align 8 %indirectarg, ptr align 8 %literal3, i32 32, i1 false) -call i32 (i32, ...) @f_va_callee(i32 signext 1, i32 signext 2, i64 3, double 4.000000e+00, double 5.000000e+00, i64 %4, [2 x i64] %7, i128 %9, ptr align 8 %indirectarg) -call i32 (i32, ...) @f_va_callee(i32 signext 1, i32 signext 2, i32 signext 3, i32 signext 4, fp128 %15, i32 signext 6, i32 signext 7, i32 8, i32 9) -call i32 (i32, ...) @f_va_callee(i32 signext 1, i32 signext 2, i32 signext 3, i32 signext 4, i128 %18, i32 signext 6, i32 signext 7, i32 8, i32 9) -call i32 (i32, ...) @f_va_callee(i32 signext 1, i32 signext 2, i32 signext 3, i32 signext 4, [2 x i64] %22, i32 signext 6, i32 signext 7, i32 8, i32 9) -call i32 (i32, ...) @f_va_callee(i32 signext 1, i32 signext 2, i32 signext 3, i32 signext 4, i32 signext 5, fp128 %24, i32 7, i32 8, i32 9) -call i32 (i32, ...) @f_va_callee(i32 signext 1, i32 signext 2, i32 signext 3, i32 signext 4, i32 signext 5, i128 %27, i32 7, i32 8, i32 9) -call i32 (i32, ...) @f_va_callee(i32 signext 1, i32 signext 2, i32 signext 3, i32 signext 4, i32 signext 5, [2 x i64] %31, i32 signext 7, i32 8, i32 9) -call i32 (i32, ...) @f_va_callee(i32 signext 1, i32 signext 2, i32 signext 3, i32 signext 4, i32 signext 5, i32 signext 6, fp128 %33, i32 8, i32 9) -call i32 (i32, ...) @f_va_callee(i32 signext 1, i32 signext 2, i32 signext 3, i32 signext 4, i32 signext 5, i32 signext 6, i128 %36, i32 8, i32 9) -call i32 (i32, ...) @f_va_callee(i32 signext 1, i32 signext 2, i32 signext 3, i32 signext 4, i32 signext 5, i32 signext 6, [2 x i64] %40, i32 8, i32 9) + call void @llvm.memcpy.p0.p0.i32(ptr align 8 %indirectarg, ptr align 8 %literal3, i32 32, i1 false) + %3 = call i32 (i32, ...) @f_va_callee(i32 signext 1, i32 signext 2, i64 3, double 4.000000e+00, double 5.000000e+00, i64 %0, [2 x i64] %1, i128 %2, ptr align 8 %indirectarg) + %5 = call i32 (i32, ...) @f_va_callee(i32 signext 1, i32 signext 2, i32 signext 3, i32 signext 4, fp128 %4, i32 signext 6, i32 signext 7, i32 8, i32 9) + %7 = call i32 (i32, ...) @f_va_callee(i32 signext 1, i32 signext 2, i32 signext 3, i32 signext 4, i128 %6, i32 signext 6, i32 signext 7, i32 8, i32 9) + %9 = call i32 (i32, ...) @f_va_callee(i32 signext 1, i32 signext 2, i32 signext 3, i32 signext 4, [2 x i64] %8, i32 signext 6, i32 signext 7, i32 8, i32 9) + %11 = call i32 (i32, ...) @f_va_callee(i32 signext 1, i32 signext 2, i32 signext 3, i32 signext 4, i32 signext 5, fp128 %10, i32 7, i32 8, i32 9) + %13 = call i32 (i32, ...) @f_va_callee(i32 signext 1, i32 signext 2, i32 signext 3, i32 signext 4, i32 signext 5, i128 %12, i32 7, i32 8, i32 9) + %15 = call i32 (i32, ...) @f_va_callee(i32 signext 1, i32 signext 2, i32 signext 3, i32 signext 4, i32 signext 5, [2 x i64] %14, i32 signext 7, i32 8, i32 9) + %17 = call i32 (i32, ...) @f_va_callee(i32 signext 1, i32 signext 2, i32 signext 3, i32 signext 4, i32 signext 5, i32 signext 6, fp128 %16, i32 8, i32 9) + %19 = call i32 (i32, ...) @f_va_callee(i32 signext 1, i32 signext 2, i32 signext 3, i32 signext 4, i32 signext 5, i32 signext 6, i128 %18, i32 8, i32 9) + %21 = call i32 (i32, ...) @f_va_callee(i32 signext 1, i32 signext 2, i32 signext 3, i32 signext 4, i32 signext 5, i32 signext 6, [2 x i64] %20, i32 8, i32 9) \ No newline at end of file diff --git a/test/test_suite/abi/riscv64-lp64d-abi.c3t b/test/test_suite/abi/riscv64-lp64d-abi.c3t index 88e7c9ab1..78d2b47aa 100644 --- a/test/test_suite/abi/riscv64-lp64d-abi.c3t +++ b/test/test_suite/abi/riscv64-lp64d-abi.c3t @@ -170,10 +170,9 @@ entry: define double @test.f_ret_double_s() #0 { entry: %literal = alloca %Double_s, align 8 - %0 = getelementptr inbounds %Double_s, ptr %literal, i32 0, i32 0 - store double 1.000000e+00, ptr %0, align 8 - %1 = load double, ptr %literal, align 8 - ret double %1 + call void @llvm.memcpy.p0.p0.i32(ptr align 8 %literal, ptr align 8 @.__const, i32 8, i1 false) + %0 = load double, ptr %literal, align 8 + ret double %0 } @@ -190,16 +189,13 @@ entry: define { double, double } @test.f_ret_double_double_s() #0 { entry: %literal = alloca %Double_double_s, align 8 - %0 = getelementptr inbounds %Double_double_s, ptr %literal, i32 0, i32 0 - store double 1.000000e+00, ptr %0, align 8 - %1 = getelementptr inbounds %Double_double_s, ptr %literal, i32 0, i32 1 - store double 2.000000e+00, ptr %1, align 8 - %2 = load double, ptr %literal, align 8 + call void @llvm.memcpy.p0.p0.i32(ptr align 8 %literal, ptr align 8 @.__const.1, i32 16, i1 false) + %0 = load double, ptr %literal, align 8 %ptroffset = getelementptr inbounds double, ptr %literal, i64 1 - %3 = load double, ptr %literal, align 8 - %4 = insertvalue { double, double } undef, double %2, 0 - %5 = insertvalue { double, double } %4, double %3, 1 - ret { double, double } %5 + %1 = load double, ptr %literal, align 8 + %2 = insertvalue { double, double } undef, double %0, 0 + %3 = insertvalue { double, double } %2, double %1, 1 + ret { double, double } %3 } @@ -216,16 +212,13 @@ entry: define { double, float } @test.f_ret_double_float_s() #0 { entry: %literal = alloca %Double_float_s, align 8 - %0 = getelementptr inbounds %Double_float_s, ptr %literal, i32 0, i32 0 - store double 1.000000e+00, ptr %0, align 8 - %1 = getelementptr inbounds %Double_float_s, ptr %literal, i32 0, i32 1 - store float 2.000000e+00, ptr %1, align 8 - %2 = load double, ptr %literal, align 8 + call void @llvm.memcpy.p0.p0.i32(ptr align 8 %literal, ptr align 8 @.__const.2, i32 16, i1 false) + %0 = load double, ptr %literal, align 8 %ptroffset = getelementptr inbounds float, ptr %literal, i64 2 - %3 = load float, ptr %literal, align 8 - %4 = insertvalue { double, float } undef, double %2, 0 - %5 = insertvalue { double, float } %4, float %3, 1 - ret { double, float } %5 + %1 = load float, ptr %literal, align 8 + %2 = insertvalue { double, float } undef, double %0, 0 + %3 = insertvalue { double, float } %2, float %1, 1 + ret { double, float } %3 } @@ -250,16 +243,13 @@ entry: define { double, i8 } @test.f_ret_double_int8_s() #0 { entry: %literal = alloca %Double_int8_s, align 8 - %0 = getelementptr inbounds %Double_int8_s, ptr %literal, i32 0, i32 0 - store double 1.000000e+00, ptr %0, align 8 - %1 = getelementptr inbounds %Double_int8_s, ptr %literal, i32 0, i32 1 - store i8 2, ptr %1, align 8 - %2 = load double, ptr %literal, align 8 + call void @llvm.memcpy.p0.p0.i32(ptr align 8 %literal, ptr align 8 @.__const.3, i32 16, i1 false) + %0 = load double, ptr %literal, align 8 %ptroffset = getelementptr inbounds i8, ptr %literal, i64 8 - %3 = load i8, ptr %literal, align 8 - %4 = insertvalue { double, i8 } undef, double %2, 0 - %5 = insertvalue { double, i8 } %4, i8 %3, 1 - ret { double, i8 } %5 + %1 = load i8, ptr %literal, align 8 + %2 = insertvalue { double, i8 } undef, double %0, 0 + %3 = insertvalue { double, i8 } %2, i8 %1, 1 + ret { double, i8 } %3 } @@ -276,16 +266,13 @@ entry: define { double, i8 } @test.f_ret_double_uint8_s() #0 { entry: %literal = alloca %Double_uint8_s, align 8 - %0 = getelementptr inbounds %Double_uint8_s, ptr %literal, i32 0, i32 0 - store double 1.000000e+00, ptr %0, align 8 - %1 = getelementptr inbounds %Double_uint8_s, ptr %literal, i32 0, i32 1 - store i8 2, ptr %1, align 8 - %2 = load double, ptr %literal, align 8 + call void @llvm.memcpy.p0.p0.i32(ptr align 8 %literal, ptr align 8 @.__const.4, i32 16, i1 false) + %0 = load double, ptr %literal, align 8 %ptroffset = getelementptr inbounds i8, ptr %literal, i64 8 - %3 = load i8, ptr %literal, align 8 - %4 = insertvalue { double, i8 } undef, double %2, 0 - %5 = insertvalue { double, i8 } %4, i8 %3, 1 - ret { double, i8 } %5 + %1 = load i8, ptr %literal, align 8 + %2 = insertvalue { double, i8 } undef, double %0, 0 + %3 = insertvalue { double, i8 } %2, i8 %1, 1 + ret { double, i8 } %3 } @@ -302,16 +289,13 @@ entry: define { double, i32 } @test.f_ret_double_int32_s() #0 { entry: %literal = alloca %Double_int32_s, align 8 - %0 = getelementptr inbounds %Double_int32_s, ptr %literal, i32 0, i32 0 - store double 1.000000e+00, ptr %0, align 8 - %1 = getelementptr inbounds %Double_int32_s, ptr %literal, i32 0, i32 1 - store i32 2, ptr %1, align 8 - %2 = load double, ptr %literal, align 8 + call void @llvm.memcpy.p0.p0.i32(ptr align 8 %literal, ptr align 8 @.__const.5, i32 16, i1 false) + %0 = load double, ptr %literal, align 8 %ptroffset = getelementptr inbounds i32, ptr %literal, i64 2 - %3 = load i32, ptr %literal, align 8 - %4 = insertvalue { double, i32 } undef, double %2, 0 - %5 = insertvalue { double, i32 } %4, i32 %3, 1 - ret { double, i32 } %5 + %1 = load i32, ptr %literal, align 8 + %2 = insertvalue { double, i32 } undef, double %0, 0 + %3 = insertvalue { double, i32 } %2, i32 %1, 1 + ret { double, i32 } %3 } @@ -328,16 +312,13 @@ entry: define { double, i64 } @test.f_ret_double_int64_s() #0 { entry: %literal = alloca %Double_int64_s, align 8 - %0 = getelementptr inbounds %Double_int64_s, ptr %literal, i32 0, i32 0 - store double 1.000000e+00, ptr %0, align 8 - %1 = getelementptr inbounds %Double_int64_s, ptr %literal, i32 0, i32 1 - store i64 2, ptr %1, align 8 - %2 = load double, ptr %literal, align 8 + call void @llvm.memcpy.p0.p0.i32(ptr align 8 %literal, ptr align 8 @.__const.6, i32 16, i1 false) + %0 = load double, ptr %literal, align 8 %ptroffset = getelementptr inbounds i64, ptr %literal, i64 1 - %3 = load i64, ptr %literal, align 8 - %4 = insertvalue { double, i64 } undef, double %2, 0 - %5 = insertvalue { double, i64 } %4, i64 %3, 1 - ret { double, i64 } %5 + %1 = load i64, ptr %literal, align 8 + %2 = insertvalue { double, i64 } undef, double %0, 0 + %3 = insertvalue { double, i64 } %2, i64 %1, 1 + ret { double, i64 } %3 } @@ -368,11 +349,9 @@ entry: define double @test.f_ret_doublearr1_s() #0 { entry: %literal = alloca %Doublearr1_s, align 8 - %0 = getelementptr inbounds %Doublearr1_s, ptr %literal, i32 0, i32 0 - %1 = getelementptr inbounds [1 x double], ptr %0, i64 0, i64 0 - store double 1.000000e+00, ptr %1, align 8 - %2 = load double, ptr %literal, align 8 - ret double %2 + call void @llvm.memcpy.p0.p0.i32(ptr align 8 %literal, ptr align 8 @.__const.7, i32 8, i1 false) + %0 = load double, ptr %literal, align 8 + ret double %0 } @@ -389,17 +368,13 @@ entry: define { double, double } @test.f_ret_doublearr2_s() #0 { entry: %literal = alloca %Doublearr2_s, align 8 - %0 = getelementptr inbounds %Doublearr2_s, ptr %literal, i32 0, i32 0 - %1 = getelementptr inbounds [2 x double], ptr %0, i64 0, i64 0 - store double 1.000000e+00, ptr %1, align 8 - %2 = getelementptr inbounds [2 x double], ptr %0, i64 0, i64 1 - store double 2.000000e+00, ptr %2, align 8 - %3 = load double, ptr %literal, align 8 + call void @llvm.memcpy.p0.p0.i32(ptr align 8 %literal, ptr align 8 @.__const.8, i32 16, i1 false) + %0 = load double, ptr %literal, align 8 %ptroffset = getelementptr inbounds double, ptr %literal, i64 1 - %4 = load double, ptr %literal, align 8 - %5 = insertvalue { double, double } undef, double %3, 0 - %6 = insertvalue { double, double } %5, double %4, 1 - ret { double, double } %6 + %1 = load double, ptr %literal, align 8 + %2 = insertvalue { double, double } undef, double %0, 0 + %3 = insertvalue { double, double } %2, double %1, 1 + ret { double, double } %3 } @@ -416,21 +391,13 @@ entry: define { double, double } @test.f_ret_doublearr2_tricky1_s() #0 { entry: %literal = alloca %Doublearr2_tricky1_s, align 8 - %0 = getelementptr inbounds %Doublearr2_tricky1_s, ptr %literal, i32 0, i32 0 - %1 = getelementptr inbounds [2 x %Inner], ptr %0, i64 0, i64 0 - %2 = getelementptr inbounds %Inner, ptr %1, i32 0, i32 0 - %3 = getelementptr inbounds [1 x double], ptr %2, i64 0, i64 0 - store double 1.000000e+00, ptr %3, align 8 - %4 = getelementptr inbounds [2 x %Inner], ptr %0, i64 0, i64 1 - %5 = getelementptr inbounds %Inner, ptr %4, i32 0, i32 0 - %6 = getelementptr inbounds [1 x double], ptr %5, i64 0, i64 0 - store double 2.000000e+00, ptr %6, align 8 - %7 = load double, ptr %literal, align 8 + call void @llvm.memcpy.p0.p0.i32(ptr align 8 %literal, ptr align 8 @.__const.9, i32 16, i1 false) + %0 = load double, ptr %literal, align 8 %ptroffset = getelementptr inbounds double, ptr %literal, i64 1 - %8 = load double, ptr %literal, align 8 - %9 = insertvalue { double, double } undef, double %7, 0 - %10 = insertvalue { double, double } %9, double %8, 1 - ret { double, double } %10 + %1 = load double, ptr %literal, align 8 + %2 = insertvalue { double, double } undef, double %0, 0 + %3 = insertvalue { double, double } %2, double %1, 1 + ret { double, double } %3 } @@ -443,12 +410,7 @@ entry: define void @test.f_ret_int_double_int_s(ptr noalias sret(%Int_double_int_s) align 8 %0) #0 { entry: %literal = alloca %Int_double_int_s, align 8 - %1 = getelementptr inbounds %Int_double_int_s, ptr %literal, i32 0, i32 0 - store i32 1, ptr %1, align 8 - %2 = getelementptr inbounds %Int_double_int_s, ptr %literal, i32 0, i32 1 - store double 2.000000e+00, ptr %2, align 8 - %3 = getelementptr inbounds %Int_double_int_s, ptr %literal, i32 0, i32 2 - store i32 3, ptr %3, align 8 + call void @llvm.memcpy.p0.p0.i32(ptr align 8 %literal, ptr align 8 @.__const.10, i32 24, i1 false) call void @llvm.memcpy.p0.p0.i32(ptr align 8 %0, ptr align 8 %literal, i32 24, i1 false) ret void } @@ -465,14 +427,9 @@ entry: define [2 x i64] @test.f_ret_char_char_double_s() #0 { entry: %literal = alloca %Char_char_double_s, align 8 - %0 = getelementptr inbounds %Char_char_double_s, ptr %literal, i32 0, i32 0 - store i8 1, ptr %0, align 8 - %1 = getelementptr inbounds %Char_char_double_s, ptr %literal, i32 0, i32 1 - store i8 2, ptr %1, align 1 - %2 = getelementptr inbounds %Char_char_double_s, ptr %literal, i32 0, i32 2 - store double 3.000000e+00, ptr %2, align 8 - %3 = load [2 x i64], ptr %literal, align 8 - ret [2 x i64] %3 + call void @llvm.memcpy.p0.p0.i32(ptr align 8 %literal, ptr align 8 @.__const.11, i32 16, i1 false) + %0 = load [2 x i64], ptr %literal, align 8 + ret [2 x i64] %0 } @@ -487,7 +444,7 @@ entry: define i64 @test.f_ret_double_u() #0 { entry: %literal = alloca %Double_u, align 8 - store double 1.000000e+00, ptr %literal, align 8 + call void @llvm.memcpy.p0.p0.i32(ptr align 8 %literal, ptr align 8 @.__const.12, i32 8, i1 false) %0 = load i64, ptr %literal, align 8 ret i64 %0 } diff --git a/test/test_suite/abi/riscv64-lp64f-lp64d-abi-2.c3t b/test/test_suite/abi/riscv64-lp64f-lp64d-abi-2.c3t index c29027117..fa84204ba 100644 --- a/test/test_suite/abi/riscv64-lp64f-lp64d-abi-2.c3t +++ b/test/test_suite/abi/riscv64-lp64f-lp64d-abi-2.c3t @@ -144,15 +144,16 @@ entry: ret void } +; Function Attrs: nounwind define float @test.f_ret_float_s() #0 { entry: %literal = alloca %Float_s, align 4 - %0 = getelementptr inbounds %Float_s, ptr %literal, i32 0, i32 0 - store float 1.000000e+00, ptr %0, align 4 - %1 = load float, ptr %literal, align 4 - ret float %1 + call void @llvm.memcpy.p0.p0.i32(ptr align 4 %literal, ptr align 4 @.__const, i32 4, i1 false) + %0 = load float, ptr %literal, align 4 + ret float %0 } +; Function Attrs: nounwind define void @test.f_float_float_s_arg(float %0, float %1) #0 { entry: %a = alloca %Float_float_s, align 4 @@ -162,21 +163,20 @@ entry: ret void } +; Function Attrs: nounwind define { float, float } @test.f_ret_float_float_s() #0 { entry: %literal = alloca %Float_float_s, align 4 - %0 = getelementptr inbounds %Float_float_s, ptr %literal, i32 0, i32 0 - store float 1.000000e+00, ptr %0, align 4 - %1 = getelementptr inbounds %Float_float_s, ptr %literal, i32 0, i32 1 - store float 2.000000e+00, ptr %1, align 4 - %2 = load float, ptr %literal, align 4 + call void @llvm.memcpy.p0.p0.i32(ptr align 4 %literal, ptr align 4 @.__const.1, i32 8, i1 false) + %0 = load float, ptr %literal, align 4 %ptroffset = getelementptr inbounds float, ptr %literal, i64 1 - %3 = load float, ptr %literal, align 4 - %4 = insertvalue { float, float } undef, float %2, 0 - %5 = insertvalue { float, float } %4, float %3, 1 - ret { float, float } %5 + %1 = load float, ptr %literal, align 4 + %2 = insertvalue { float, float } undef, float %0, 0 + %3 = insertvalue { float, float } %2, float %1, 1 + ret { float, float } %3 } +; Function Attrs: nounwind define void @test.f_float_float_s_arg_insufficient_fprs(float %0, float %1, float %2, float %3, float %4, float %5, float %6, i64 %7) #0 { entry: %h = alloca %Float_float_s, align 4 @@ -184,6 +184,7 @@ entry: ret void } +; Function Attrs: nounwind define void @test.f_float_int8_s_arg(float %0, i8 %1) #0 { entry: %a = alloca %Float_int8_s, align 4 @@ -193,21 +194,20 @@ entry: ret void } +; Function Attrs: nounwind define { float, i8 } @test.f_ret_float_int8_s() #0 { entry: %literal = alloca %Float_int8_s, align 4 - %0 = getelementptr inbounds %Float_int8_s, ptr %literal, i32 0, i32 0 - store float 1.000000e+00, ptr %0, align 4 - %1 = getelementptr inbounds %Float_int8_s, ptr %literal, i32 0, i32 1 - store i8 2, ptr %1, align 4 - %2 = load float, ptr %literal, align 4 + call void @llvm.memcpy.p0.p0.i32(ptr align 4 %literal, ptr align 4 @.__const.2, i32 8, i1 false) + %0 = load float, ptr %literal, align 4 %ptroffset = getelementptr inbounds i8, ptr %literal, i64 4 - %3 = load i8, ptr %literal, align 4 - %4 = insertvalue { float, i8 } undef, float %2, 0 - %5 = insertvalue { float, i8 } %4, i8 %3, 1 - ret { float, i8 } %5 + %1 = load i8, ptr %literal, align 4 + %2 = insertvalue { float, i8 } undef, float %0, 0 + %3 = insertvalue { float, i8 } %2, i8 %1, 1 + ret { float, i8 } %3 } +; Function Attrs: nounwind define void @test.f_float_uint8_s_arg(float %0, i8 %1) #0 { entry: %a = alloca %Float_uint8_s, align 4 @@ -217,21 +217,20 @@ entry: ret void } +; Function Attrs: nounwind define { float, i8 } @test.f_ret_float_uint8_s() #0 { entry: %literal = alloca %Float_uint8_s, align 4 - %0 = getelementptr inbounds %Float_uint8_s, ptr %literal, i32 0, i32 0 - store float 1.000000e+00, ptr %0, align 4 - %1 = getelementptr inbounds %Float_uint8_s, ptr %literal, i32 0, i32 1 - store i8 2, ptr %1, align 4 - %2 = load float, ptr %literal, align 4 + call void @llvm.memcpy.p0.p0.i32(ptr align 4 %literal, ptr align 4 @.__const.3, i32 8, i1 false) + %0 = load float, ptr %literal, align 4 %ptroffset = getelementptr inbounds i8, ptr %literal, i64 4 - %3 = load i8, ptr %literal, align 4 - %4 = insertvalue { float, i8 } undef, float %2, 0 - %5 = insertvalue { float, i8 } %4, i8 %3, 1 - ret { float, i8 } %5 + %1 = load i8, ptr %literal, align 4 + %2 = insertvalue { float, i8 } undef, float %0, 0 + %3 = insertvalue { float, i8 } %2, i8 %1, 1 + ret { float, i8 } %3 } +; Function Attrs: nounwind define void @test.f_float_int32_s_arg(float %0, i32 %1) #0 { entry: %a = alloca %Float_int32_s, align 4 @@ -241,21 +240,20 @@ entry: ret void } +; Function Attrs: nounwind define { float, i32 } @test.f_ret_float_int32_s() #0 { entry: %literal = alloca %Float_int32_s, align 4 - %0 = getelementptr inbounds %Float_int32_s, ptr %literal, i32 0, i32 0 - store float 1.000000e+00, ptr %0, align 4 - %1 = getelementptr inbounds %Float_int32_s, ptr %literal, i32 0, i32 1 - store i32 2, ptr %1, align 4 - %2 = load float, ptr %literal, align 4 + call void @llvm.memcpy.p0.p0.i32(ptr align 4 %literal, ptr align 4 @.__const.4, i32 8, i1 false) + %0 = load float, ptr %literal, align 4 %ptroffset = getelementptr inbounds i32, ptr %literal, i64 1 - %3 = load i32, ptr %literal, align 4 - %4 = insertvalue { float, i32 } undef, float %2, 0 - %5 = insertvalue { float, i32 } %4, i32 %3, 1 - ret { float, i32 } %5 + %1 = load i32, ptr %literal, align 4 + %2 = insertvalue { float, i32 } undef, float %0, 0 + %3 = insertvalue { float, i32 } %2, i32 %1, 1 + ret { float, i32 } %3 } +; Function Attrs: nounwind define void @test.f_float_int64_s_arg(float %0, i64 %1) #0 { entry: %a = alloca %Float_int64_s, align 8 @@ -265,21 +263,20 @@ entry: ret void } +; Function Attrs: nounwind define { float, i64 } @test.f_ret_float_int64_s() #0 { entry: %literal = alloca %Float_int64_s, align 8 - %0 = getelementptr inbounds %Float_int64_s, ptr %literal, i32 0, i32 0 - store float 1.000000e+00, ptr %0, align 8 - %1 = getelementptr inbounds %Float_int64_s, ptr %literal, i32 0, i32 1 - store i64 2, ptr %1, align 8 - %2 = load float, ptr %literal, align 8 + call void @llvm.memcpy.p0.p0.i32(ptr align 8 %literal, ptr align 8 @.__const.5, i32 16, i1 false) + %0 = load float, ptr %literal, align 8 %ptroffset = getelementptr inbounds i64, ptr %literal, i64 1 - %3 = load i64, ptr %literal, align 8 - %4 = insertvalue { float, i64 } undef, float %2, 0 - %5 = insertvalue { float, i64 } %4, i64 %3, 1 - ret { float, i64 } %5 + %1 = load i64, ptr %literal, align 8 + %2 = insertvalue { float, i64 } undef, float %0, 0 + %3 = insertvalue { float, i64 } %2, i64 %1, 1 + ret { float, i64 } %3 } +; Function Attrs: nounwind define void @test.f_float_int8_s_arg_insufficient_gprs(i32 signext %0, i32 signext %1, i32 signext %2, i32 signext %3, i32 signext %4, i32 signext %5, i32 signext %6, i32 signext %7, i64 %8) #0 { entry: %i = alloca %Float_int8_s, align 4 @@ -287,6 +284,7 @@ entry: ret void } +; Function Attrs: nounwind define void @test.f_struct_float_int8_insufficient_fprs(float %0, float %1, float %2, float %3, float %4, float %5, float %6, float %7, i64 %8) #0 { entry: %i = alloca %Float_int8_s, align 4 @@ -294,6 +292,7 @@ entry: ret void } +; Function Attrs: nounwind define void @test.f_floatarr1_s_arg(float %0) #0 { entry: %a = alloca %Floatarr1_s, align 4 @@ -301,16 +300,16 @@ entry: ret void } +; Function Attrs: nounwind define float @test.f_ret_floatarr1_s() #0 { entry: %literal = alloca %Floatarr1_s, align 4 - %0 = getelementptr inbounds %Floatarr1_s, ptr %literal, i32 0, i32 0 - %1 = getelementptr inbounds [1 x float], ptr %0, i64 0, i64 0 - store float 1.000000e+00, ptr %1, align 4 - %2 = load float, ptr %literal, align 4 - ret float %2 + call void @llvm.memcpy.p0.p0.i32(ptr align 4 %literal, ptr align 4 @.__const.6, i32 4, i1 false) + %0 = load float, ptr %literal, align 4 + ret float %0 } +; Function Attrs: nounwind define void @test.f_floatarr2_s_arg(float %0, float %1) #0 { entry: %a = alloca %Floatarr2_s, align 4 @@ -320,22 +319,20 @@ entry: ret void } +; Function Attrs: nounwind define { float, float } @test.f_ret_floatarr2_s() #0 { entry: %literal = alloca %Floatarr2_s, align 4 - %0 = getelementptr inbounds %Floatarr2_s, ptr %literal, i32 0, i32 0 - %1 = getelementptr inbounds [2 x float], ptr %0, i64 0, i64 0 - store float 1.000000e+00, ptr %1, align 4 - %2 = getelementptr inbounds [2 x float], ptr %0, i64 0, i64 1 - store float 2.000000e+00, ptr %2, align 4 - %3 = load float, ptr %literal, align 4 + call void @llvm.memcpy.p0.p0.i32(ptr align 4 %literal, ptr align 4 @.__const.7, i32 8, i1 false) + %0 = load float, ptr %literal, align 4 %ptroffset = getelementptr inbounds float, ptr %literal, i64 1 - %4 = load float, ptr %literal, align 4 - %5 = insertvalue { float, float } undef, float %3, 0 - %6 = insertvalue { float, float } %5, float %4, 1 - ret { float, float } %6 + %1 = load float, ptr %literal, align 4 + %2 = insertvalue { float, float } undef, float %0, 0 + %3 = insertvalue { float, float } %2, float %1, 1 + ret { float, float } %3 } +; Function Attrs: nounwind define void @test.f_floatarr2_tricky1_s_arg(float %0, float %1) #0 { entry: %a = alloca %Floatarr2_tricky1_s, align 4 @@ -345,26 +342,20 @@ entry: ret void } +; Function Attrs: nounwind define { float, float } @test.f_ret_floatarr2_tricky1_s() #0 { entry: %literal = alloca %Floatarr2_tricky1_s, align 4 - %0 = getelementptr inbounds %Floatarr2_tricky1_s, ptr %literal, i32 0, i32 0 - %1 = getelementptr inbounds [2 x %Inner], ptr %0, i64 0, i64 0 - %2 = getelementptr inbounds %Inner, ptr %1, i32 0, i32 0 - %3 = getelementptr inbounds [1 x float], ptr %2, i64 0, i64 0 - store float 1.000000e+00, ptr %3, align 4 - %4 = getelementptr inbounds [2 x %Inner], ptr %0, i64 0, i64 1 - %5 = getelementptr inbounds %Inner, ptr %4, i32 0, i32 0 - %6 = getelementptr inbounds [1 x float], ptr %5, i64 0, i64 0 - store float 2.000000e+00, ptr %6, align 4 - %7 = load float, ptr %literal, align 4 + call void @llvm.memcpy.p0.p0.i32(ptr align 4 %literal, ptr align 4 @.__const.8, i32 8, i1 false) + %0 = load float, ptr %literal, align 4 %ptroffset = getelementptr inbounds float, ptr %literal, i64 1 - %8 = load float, ptr %literal, align 4 - %9 = insertvalue { float, float } undef, float %7, 0 - %10 = insertvalue { float, float } %9, float %8, 1 - ret { float, float } %10 + %1 = load float, ptr %literal, align 4 + %2 = insertvalue { float, float } undef, float %0, 0 + %3 = insertvalue { float, float } %2, float %1, 1 + ret { float, float } %3 } +; Function Attrs: nounwind define void @test.f_int_float_int_s_arg([2 x i64] %0) #0 { entry: %a = alloca %Int_float_int_s, align 4 @@ -374,21 +365,18 @@ entry: ret void } +; Function Attrs: nounwind define [2 x i64] @test.f_ret_int_float_int_s() #0 { entry: %literal = alloca %Int_float_int_s, align 4 %tempcoerce = alloca [2 x i64], align 8 - %0 = getelementptr inbounds %Int_float_int_s, ptr %literal, i32 0, i32 0 - store i32 1, ptr %0, align 4 - %1 = getelementptr inbounds %Int_float_int_s, ptr %literal, i32 0, i32 1 - store float 2.000000e+00, ptr %1, align 4 - %2 = getelementptr inbounds %Int_float_int_s, ptr %literal, i32 0, i32 2 - store i32 3, ptr %2, align 4 + call void @llvm.memcpy.p0.p0.i32(ptr align 4 %literal, ptr align 4 @.__const.9, i32 12, i1 false) call void @llvm.memcpy.p0.p0.i32(ptr align 8 %tempcoerce, ptr align 4 %literal, i32 12, i1 false) - %3 = load [2 x i64], ptr %tempcoerce, align 8 - ret [2 x i64] %3 + %0 = load [2 x i64], ptr %tempcoerce, align 8 + ret [2 x i64] %0 } +; Function Attrs: nounwind define void @test.f_char_char_float_s_arg(i64 %0) #0 { entry: %a = alloca %Char_char_float_s, align 4 @@ -396,19 +384,16 @@ entry: ret void } +; Function Attrs: nounwind define i64 @test.f_ret_char_char_float_s() #0 { entry: %literal = alloca %Char_char_float_s, align 4 - %0 = getelementptr inbounds %Char_char_float_s, ptr %literal, i32 0, i32 0 - store i8 1, ptr %0, align 4 - %1 = getelementptr inbounds %Char_char_float_s, ptr %literal, i32 0, i32 1 - store i8 2, ptr %1, align 1 - %2 = getelementptr inbounds %Char_char_float_s, ptr %literal, i32 0, i32 2 - store float 3.000000e+00, ptr %2, align 4 - %3 = load i64, ptr %literal, align 4 - ret i64 %3 + call void @llvm.memcpy.p0.p0.i32(ptr align 4 %literal, ptr align 4 @.__const.10, i32 8, i1 false) + %0 = load i64, ptr %literal, align 4 + ret i64 %0 } +; Function Attrs: nounwind define void @test.f_float_u_arg(i64 %0) #0 { entry: %a = alloca %Float_u, align 4 @@ -418,11 +403,12 @@ entry: ret void } +; Function Attrs: nounwind define i64 @test.f_ret_float_u() #0 { entry: %literal = alloca %Float_u, align 4 %tempcoerce = alloca i64, align 8 - store float 1.000000e+00, ptr %literal, align 4 + call void @llvm.memcpy.p0.p0.i32(ptr align 4 %literal, ptr align 4 @.__const.11, i32 4, i1 false) call void @llvm.memcpy.p0.p0.i32(ptr align 8 %tempcoerce, ptr align 4 %literal, i32 4, i1 false) %0 = load i64, ptr %tempcoerce, align 8 ret i64 %0 diff --git a/test/test_suite/abi/small_struct_x64.c3t b/test/test_suite/abi/small_struct_x64.c3t index 5629a4969..823464552 100644 --- a/test/test_suite/abi/small_struct_x64.c3t +++ b/test/test_suite/abi/small_struct_x64.c3t @@ -33,24 +33,19 @@ entry: %tempcoerce = alloca i24, align 4 %result = alloca %Foo, align 1 %tempcoerce1 = alloca i24, align 4 - %0 = getelementptr inbounds %Foo, ptr %literal, i32 0, i32 0 - store i8 4, ptr %0, align 1 - %1 = getelementptr inbounds %Foo, ptr %literal, i32 0, i32 1 - store i8 5, ptr %1, align 1 - %2 = getelementptr inbounds %Foo, ptr %literal, i32 0, i32 2 - store i8 6, ptr %2, align 1 + call void @llvm.memcpy.p0.p0.i32(ptr align 1 %literal, ptr align 1 @.__const, i32 3, i1 false) call void @llvm.memcpy.p0.p0.i32(ptr align 4 %tempcoerce, ptr align 1 %literal, i32 3, i1 false) - %3 = load i24, ptr %tempcoerce, align 4 - %4 = call i24 @test.getFoo(i24 %3) - store i24 %4, ptr %tempcoerce1, align 4 + %0 = load i24, ptr %tempcoerce, align 4 + %1 = call i24 @test.getFoo(i24 %0) + store i24 %1, ptr %tempcoerce1, align 4 call void @llvm.memcpy.p0.p0.i32(ptr align 1 %result, ptr align 4 %tempcoerce1, i32 3, i1 false) call void @llvm.memcpy.p0.p0.i32(ptr align 1 %y, ptr align 1 %result, i32 3, i1 false) - %5 = getelementptr inbounds %Foo, ptr %y, i32 0, i32 0 - %6 = load i8, ptr %5, align 1 - %zext = zext i8 %6 to i32 - %7 = getelementptr inbounds %Foo, ptr %y, i32 0, i32 2 - %8 = load i8, ptr %7, align 1 - %zext2 = zext i8 %8 to i32 + %2 = getelementptr inbounds %Foo, ptr %y, i32 0, i32 0 + %3 = load i8, ptr %2, align 1 + %zext = zext i8 %3 to i32 + %4 = getelementptr inbounds %Foo, ptr %y, i32 0, i32 2 + %5 = load i8, ptr %4, align 1 + %zext2 = zext i8 %5 to i32 %add = add i32 %zext, %zext2 ret i32 %add } @@ -64,16 +59,9 @@ entry: %tempcoerce1 = alloca i24, align 4 store i24 %0, ptr %tempcoerce, align 4 call void @llvm.memcpy.p0.p0.i32(ptr align 1 %f, ptr align 4 %tempcoerce, i32 3, i1 false) - %1 = getelementptr inbounds %Foo, ptr %literal, i32 0, i32 0 - store i8 1, ptr %1, align 1 - %2 = getelementptr inbounds %Foo, ptr %literal, i32 0, i32 1 - store i8 2, ptr %2, align 1 - %3 = getelementptr inbounds %Foo, ptr %literal, i32 0, i32 2 - store i8 3, ptr %3, align 1 + call void @llvm.memcpy.p0.p0.i32(ptr align 1 %literal, ptr align 1 @.__const.1, i32 3, i1 false) call void @llvm.memcpy.p0.p0.i32(ptr align 4 %tempcoerce1, ptr align 1 %literal, i32 3, i1 false) - %4 = load i24, ptr %tempcoerce1, align 4 - ret i24 %4 + %1 = load i24, ptr %tempcoerce1, align 4 + ret i24 %1 } -declare void @llvm.memcpy.p0.p0.i32(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i32, i1 immarg) #1 - diff --git a/test/test_suite/abi/sysv_direct_coerce.c3t b/test/test_suite/abi/sysv_direct_coerce.c3t index c57b3de15..dfe30f64e 100644 --- a/test/test_suite/abi/sysv_direct_coerce.c3t +++ b/test/test_suite/abi/sysv_direct_coerce.c3t @@ -24,19 +24,12 @@ entry: store <2 x float> %0, ptr %r, align 8 %ptroffset = getelementptr inbounds <2 x float>, ptr %r, i64 1 store <2 x float> %1, ptr %ptroffset, align 8 - %2 = getelementptr inbounds %Rectangle, ptr %literal, i32 0, i32 0 - store float 1.000000e+00, ptr %2, align 4 - %3 = getelementptr inbounds %Rectangle, ptr %literal, i32 0, i32 1 - store float 2.000000e+00, ptr %3, align 4 - %4 = getelementptr inbounds %Rectangle, ptr %literal, i32 0, i32 2 - store float 3.000000e+00, ptr %4, align 4 - %5 = getelementptr inbounds %Rectangle, ptr %literal, i32 0, i32 3 - store float 4.000000e+00, ptr %5, align 4 + call void @llvm.memcpy.p0.p0.i32(ptr align 4 %literal, ptr align 4 @.__const, i32 16, i1 false) call void @llvm.memcpy.p0.p0.i32(ptr align 8 %coerce, ptr align 4 %literal, i32 16, i1 false) - %6 = getelementptr inbounds { <2 x float>, <2 x float> }, ptr %coerce, i32 0, i32 0 - %lo = load <2 x float>, ptr %6, align 8 - %7 = getelementptr inbounds { <2 x float>, <2 x float> }, ptr %coerce, i32 0, i32 1 - %hi = load <2 x float>, ptr %7, align 8 + %2 = getelementptr inbounds { <2 x float>, <2 x float> }, ptr %coerce, i32 0, i32 0 + %lo = load <2 x float>, ptr %2, align 8 + %3 = getelementptr inbounds { <2 x float>, <2 x float> }, ptr %coerce, i32 0, i32 1 + %hi = load <2 x float>, ptr %3, align 8 call void @foo.test(<2 x float> %lo, <2 x float> %hi) ret void } \ No newline at end of file diff --git a/test/test_suite/bitstruct/bitstruct_in_subarray.c3t b/test/test_suite/bitstruct/bitstruct_in_subarray.c3t new file mode 100644 index 000000000..3e37bba93 --- /dev/null +++ b/test/test_suite/bitstruct/bitstruct_in_subarray.c3t @@ -0,0 +1,25 @@ +// #target: macos-x64 +module test; +bitstruct StructFieldKind : char +{ + bool is_inline : 0; + bool is_union : 1; +} + +fn void! main() +{ + StructFieldKind[] xx = { { .is_union = true } }; +} + +/* #expect: test.ll + +define i64 @test.main() #0 { +entry: + %xx = alloca %"char[]", align 8 + %literal = alloca [1 x i8], align 1 + call void @llvm.memcpy.p0.p0.i32(ptr align 1 %literal, ptr align 1 @.__const, i32 1, i1 false) + %0 = insertvalue %"char[]" undef, ptr %literal, 0 + %1 = insertvalue %"char[]" %0, i64 1, 1 + store %"char[]" %1, ptr %xx, align 8 + ret i64 0 +} \ No newline at end of file diff --git a/test/test_suite/cast/cast_subarray.c3t b/test/test_suite/cast/cast_subarray.c3t index 1e50a18f1..796806599 100644 --- a/test/test_suite/cast/cast_subarray.c3t +++ b/test/test_suite/cast/cast_subarray.c3t @@ -24,12 +24,9 @@ entry: call void @llvm.memcpy.p0.p0.i32(ptr align 8 %bcd, ptr align 8 %abc, i32 16, i1 false) store %"int[]" zeroinitializer, ptr %cde, align 8 call void @llvm.memcpy.p0.p0.i32(ptr align 8 %xyz, ptr align 8 %cde, i32 16, i1 false) - %0 = getelementptr inbounds [2 x i32], ptr %literal, i64 0, i64 0 - store i32 1, ptr %0, align 4 - %1 = getelementptr inbounds [2 x i32], ptr %literal, i64 0, i64 1 - store i32 2, ptr %1, align 4 - %2 = insertvalue %"int[]" undef, ptr %literal, 0 - %3 = insertvalue %"int[]" %2, i64 2, 1 - store %"int[]" %3, ptr %xyz2, align 8 + call void @llvm.memcpy.p0.p0.i32(ptr align 4 %literal, ptr align 4 @.__const, i32 8, i1 false) + %0 = insertvalue %"int[]" undef, ptr %literal, 0 + %1 = insertvalue %"int[]" %0, i64 2, 1 + store %"int[]" %1, ptr %xyz2, align 8 ret void } diff --git a/test/test_suite/cast/implicit_infer_len_cast.c3t b/test/test_suite/cast/implicit_infer_len_cast.c3t index c2d3a651e..1aa969b37 100644 --- a/test/test_suite/cast/implicit_infer_len_cast.c3t +++ b/test/test_suite/cast/implicit_infer_len_cast.c3t @@ -31,23 +31,16 @@ fn void main() call void @llvm.memcpy.p0.p0.i32(ptr align 8 %y, ptr align 8 @.__const.1, i32 8, i1 false) call void @llvm.memcpy.p0.p0.i32(ptr align 8 %z, ptr align 8 %y, i32 8, i1 false) call void @llvm.memcpy.p0.p0.i32(ptr align 8 %w, ptr align 8 %z, i32 8, i1 false) - %0 = getelementptr inbounds [1 x <2 x i32>], ptr %literal, i64 0, i64 0 - %1 = getelementptr inbounds <2 x i32>, ptr %0, i64 0, i64 0 - store i32 1, ptr %1, align 4 - %2 = getelementptr inbounds <2 x i32>, ptr %0, i64 0, i64 1 - store i32 3, ptr %2, align 4 - %3 = insertvalue %"int[<2>][]" undef, ptr %literal, 0 - %4 = insertvalue %"int[<2>][]" %3, i64 1, 1 - store %"int[<2>][]" %4, ptr %aa, align 8 - %5 = getelementptr inbounds [1 x %"int[]"], ptr %bb, i64 0, i64 0 - %6 = getelementptr inbounds [2 x i32], ptr %literal1, i64 0, i64 0 - store i32 1, ptr %6, align 4 - %7 = getelementptr inbounds [2 x i32], ptr %literal1, i64 0, i64 1 - store i32 3, ptr %7, align 4 - %8 = insertvalue %"int[]" undef, ptr %literal1, 0 - %9 = insertvalue %"int[]" %8, i64 2, 1 - store %"int[]" %9, ptr %5, align 16 + call void @llvm.memcpy.p0.p0.i32(ptr align 8 %literal, ptr align 8 @.__const.2, i32 8, i1 false) + %0 = insertvalue %"int[<2>][]" undef, ptr %literal, 0 + %1 = insertvalue %"int[<2>][]" %0, i64 1, 1 + store %"int[<2>][]" %1, ptr %aa, align 8 + %2 = getelementptr inbounds [1 x %"int[]"], ptr %bb, i64 0, i64 0 + call void @llvm.memcpy.p0.p0.i32(ptr align 4 %literal1, ptr align 4 @.__const.3, i32 8, i1 false) + %3 = insertvalue %"int[]" undef, ptr %literal1, 0 + %4 = insertvalue %"int[]" %3, i64 2, 1 + store %"int[]" %4, ptr %2, align 16 call void @llvm.memcpy.p0.p0.i32(ptr align 16 %z2, ptr align 4 %x, i32 16, i1 false) - %10 = getelementptr inbounds [2 x [2 x i32]], ptr %z2, i64 0, i64 1 - %11 = getelementptr inbounds [2 x i32], ptr %10, i64 0, i64 1 + %5 = getelementptr inbounds [2 x [2 x i32]], ptr %z2, i64 0, i64 1 + %6 = getelementptr inbounds [2 x i32], ptr %5, i64 0, i64 1 ret void diff --git a/test/test_suite/compile_time/untyped_conversions.c3t b/test/test_suite/compile_time/untyped_conversions.c3t index 0e123111c..b9bbe579e 100644 --- a/test/test_suite/compile_time/untyped_conversions.c3t +++ b/test/test_suite/compile_time/untyped_conversions.c3t @@ -45,6 +45,10 @@ fn void main() @"$ct.double" = linkonce global %.introspect { i8 4, ptr null, i64 8, i64 0, i64 0, [0 x i64] zeroinitializer }, align 8 @"$ct.a2$double" = linkonce global %.introspect { i8 15, ptr null, i64 16, i64 ptrtoint (ptr @"$ct.double" to i64), i64 2, [0 x i64] zeroinitializer }, align 8 @"$ct.a1$a2$double" = linkonce global %.introspect { i8 15, ptr null, i64 16, i64 ptrtoint (ptr @"$ct.a2$double" to i64), i64 1, [0 x i64] zeroinitializer }, align 8 +@.__const.5 = private unnamed_addr constant [2 x i32] [i32 1, i32 2], align 4 +@.__const.6 = private unnamed_addr constant [2 x i32] [i32 3, i32 4], align 4 +@.__const.7 = private unnamed_addr constant [2 x i32] [i32 2, i32 7], align 4 +@.__const.8 = private unnamed_addr constant [2 x i32] [i32 2, i32 7], align 4 ; Function Attrs: nounwind define void @test.test(i64 %0, ptr %1, i64 %2, double %3) #0 { @@ -113,33 +117,21 @@ entry: %13 = getelementptr inbounds [4 x %any], ptr %varargslots, i64 0, i64 3 store %any %12, ptr %13, align 16 %14 = call i64 @std.io.printfn(ptr %retparam, ptr @.str.4, i64 14, ptr %varargslots, i64 4) - %15 = getelementptr inbounds [2 x i32], ptr %literal, i64 0, i64 0 - store i32 1, ptr %15, align 4 - %16 = getelementptr inbounds [2 x i32], ptr %literal, i64 0, i64 1 - store i32 2, ptr %16, align 4 - %17 = load i64, ptr %literal, align 4 - %18 = getelementptr inbounds [2 x i32], ptr %literal1, i64 0, i64 0 - store i32 3, ptr %18, align 4 - %19 = getelementptr inbounds [2 x i32], ptr %literal1, i64 0, i64 1 - store i32 4, ptr %19, align 4 - %20 = insertvalue %"int[]" undef, ptr %literal1, 0 - %21 = insertvalue %"int[]" %20, i64 2, 1 + call void @llvm.memcpy.p0.p0.i32(ptr align 4 %literal, ptr align 4 @.__const.5, i32 8, i1 false) + %15 = load i64, ptr %literal, align 4 + call void @llvm.memcpy.p0.p0.i32(ptr align 4 %literal1, ptr align 4 @.__const.6, i32 8, i1 false) + %16 = insertvalue %"int[]" undef, ptr %literal1, 0 + %17 = insertvalue %"int[]" %16, i64 2, 1 store <2 x i32> , ptr %taddr, align 8 - %22 = load double, ptr %taddr, align 8 - call void @test.test(i64 %17, ptr %literal1, i64 2, double %22) - %23 = getelementptr inbounds [2 x i32], ptr %literal2, i64 0, i64 0 - store i32 2, ptr %23, align 4 - %24 = getelementptr inbounds [2 x i32], ptr %literal2, i64 0, i64 1 - store i32 7, ptr %24, align 4 - %25 = load i64, ptr %literal2, align 4 - %26 = getelementptr inbounds [2 x i32], ptr %literal3, i64 0, i64 0 - store i32 2, ptr %26, align 4 - %27 = getelementptr inbounds [2 x i32], ptr %literal3, i64 0, i64 1 - store i32 7, ptr %27, align 4 - %28 = insertvalue %"int[]" undef, ptr %literal3, 0 - %29 = insertvalue %"int[]" %28, i64 2, 1 + %18 = load double, ptr %taddr, align 8 + call void @test.test(i64 %15, ptr %literal1, i64 2, double %18) + call void @llvm.memcpy.p0.p0.i32(ptr align 4 %literal2, ptr align 4 @.__const.7, i32 8, i1 false) + %19 = load i64, ptr %literal2, align 4 + call void @llvm.memcpy.p0.p0.i32(ptr align 4 %literal3, ptr align 4 @.__const.8, i32 8, i1 false) + %20 = insertvalue %"int[]" undef, ptr %literal3, 0 + %21 = insertvalue %"int[]" %20, i64 2, 1 store <2 x i32> , ptr %taddr4, align 8 - %30 = load double, ptr %taddr4, align 8 - call void @test.test(i64 %25, ptr %literal3, i64 2, double %30) + %22 = load double, ptr %taddr4, align 8 + call void @test.test(i64 %19, ptr %literal3, i64 2, double %22) ret void } diff --git a/test/test_suite/enumerations/enum_values.c3t b/test/test_suite/enumerations/enum_values.c3t index 615499013..7d38672e0 100644 --- a/test/test_suite/enumerations/enum_values.c3t +++ b/test/test_suite/enumerations/enum_values.c3t @@ -26,13 +26,10 @@ define void @test.test(i32 %0) #0 { entry: %zonk = alloca i32, align 4 %literal = alloca [2 x i32], align 4 - %1 = getelementptr inbounds [2 x i32], ptr %literal, i64 0, i64 0 - store i32 0, ptr %1, align 4 - %2 = getelementptr inbounds [2 x i32], ptr %literal, i64 0, i64 1 - store i32 1, ptr %2, align 4 + call void @llvm.memcpy.p0.p0.i32(ptr align 4 %literal, ptr align 4 @.__const, i32 8, i1 false) %sext = sext i32 %0 to i64 - %3 = getelementptr inbounds [2 x i32], ptr %literal, i64 0, i64 %sext - %4 = load i32, ptr %3, align 4 - store i32 %4, ptr %zonk, align 4 + %1 = getelementptr inbounds [2 x i32], ptr %literal, i64 0, i64 %sext + %2 = load i32, ptr %1, align 4 + store i32 %2, ptr %zonk, align 4 ret void } diff --git a/test/test_suite/errors/error_introspect.c3t b/test/test_suite/errors/error_introspect.c3t index 4026930b2..d47e4dac0 100644 --- a/test/test_suite/errors/error_introspect.c3t +++ b/test/test_suite/errors/error_introspect.c3t @@ -32,7 +32,7 @@ fn void main() @"$ct.sa$String" = linkonce global %.introspect { i8 16, ptr null, i64 16, i64 ptrtoint (ptr @"$ct.String" to i64), i64 0, [0 x i64] zeroinitializer }, align 8 @.str.4 = private unnamed_addr constant [15 x i8] c"Foo.values: %s\00", align 1 @"$ct.a2$foo.Foo" = linkonce global %.introspect { i8 15, ptr null, i64 16, i64 ptrtoint (ptr @"$ct.foo.Foo" to i64), i64 2, [0 x i64] zeroinitializer }, align 8 -@.str.5 = private unnamed_addr constant [17 x i8] c"Foo.elements: %s\00", align 1 +@.str.6 = private unnamed_addr constant [17 x i8] c"Foo.elements: %s\00", align 1 @"$ct.long" = linkonce global %.introspect { i8 2, ptr null, i64 8, i64 0, i64 0, [0 x i64] zeroinitializer }, align 8 entry: @@ -46,32 +46,26 @@ entry: %retparam4 = alloca i64, align 8 %varargslots5 = alloca [1 x %any], align 16 %taddr = alloca i64, align 8 - %0 = getelementptr inbounds [2 x %"char[]"], ptr %literal, i64 0, i64 0 - store %"char[]" { ptr @.str, i64 3 }, ptr %0, align 8 - %1 = getelementptr inbounds [2 x %"char[]"], ptr %literal, i64 0, i64 1 - store %"char[]" { ptr @.str.2, i64 3 }, ptr %1, align 8 - %2 = insertvalue %"char[][]" undef, ptr %literal, 0 - %3 = insertvalue %"char[][]" %2, i64 2, 1 - store %"char[][]" %3, ptr %x, align 8 - %4 = insertvalue %any undef, ptr %x, 0 - %5 = insertvalue %any %4, i64 ptrtoint (ptr @"$ct.sa$String" to i64), 1 - %6 = getelementptr inbounds [1 x %any], ptr %varargslots, i64 0, i64 0 - store %any %5, ptr %6, align 16 - %7 = call i64 @std.io.printfn(ptr %retparam, ptr @.str.3, i64 13, ptr %varargslots, i64 1) - %8 = getelementptr inbounds [2 x i64], ptr %literal3, i64 0, i64 0 - store i64 ptrtoint (ptr @"foo.Foo$BAR" to i64), ptr %8, align 8 - %9 = getelementptr inbounds [2 x i64], ptr %literal3, i64 0, i64 1 - store i64 ptrtoint (ptr @"foo.Foo$BAZ" to i64), ptr %9, align 8 - %10 = insertvalue %any undef, ptr %literal3, 0 - %11 = insertvalue %any %10, i64 ptrtoint (ptr @"$ct.a2$foo.Foo" to i64), 1 - %12 = getelementptr inbounds [1 x %any], ptr %varargslots2, i64 0, i64 0 - store %any %11, ptr %12, align 16 - %13 = call i64 @std.io.printfn(ptr %retparam1, ptr @.str.4, i64 14, ptr %varargslots2, i64 1) + call void @llvm.memcpy.p0.p0.i32(ptr align 8 %literal, ptr align 16 @.__const, i32 32, i1 false) + %0 = insertvalue %"char[][]" undef, ptr %literal, 0 + %1 = insertvalue %"char[][]" %0, i64 2, 1 + store %"char[][]" %1, ptr %x, align 8 + %2 = insertvalue %any undef, ptr %x, 0 + %3 = insertvalue %any %2, i64 ptrtoint (ptr @"$ct.sa$String" to i64), 1 + %4 = getelementptr inbounds [1 x %any], ptr %varargslots, i64 0, i64 0 + store %any %3, ptr %4, align 16 + %5 = call i64 @std.io.printfn(ptr %retparam, ptr @.str.3, i64 13, ptr %varargslots, i64 1) + call void @llvm.memcpy.p0.p0.i32(ptr align 8 %literal3, ptr align 16 @.__const.5, i32 16, i1 false) + %6 = insertvalue %any undef, ptr %literal3, 0 + %7 = insertvalue %any %6, i64 ptrtoint (ptr @"$ct.a2$foo.Foo" to i64), 1 + %8 = getelementptr inbounds [1 x %any], ptr %varargslots2, i64 0, i64 0 + store %any %7, ptr %8, align 16 + %9 = call i64 @std.io.printfn(ptr %retparam1, ptr @.str.4, i64 14, ptr %varargslots2, i64 1) store i64 2, ptr %taddr, align 8 - %14 = insertvalue %any undef, ptr %taddr, 0 - %15 = insertvalue %any %14, i64 ptrtoint (ptr @"$ct.long" to i64), 1 - %16 = getelementptr inbounds [1 x %any], ptr %varargslots5, i64 0, i64 0 - store %any %15, ptr %16, align 16 - %17 = call i64 @std.io.printfn(ptr %retparam4, ptr @.str.5, i64 16, ptr %varargslots5, i64 1) + %10 = insertvalue %any undef, ptr %taddr, 0 + %11 = insertvalue %any %10, i64 ptrtoint (ptr @"$ct.long" to i64), 1 + %12 = getelementptr inbounds [1 x %any], ptr %varargslots5, i64 0, i64 0 + store %any %11, ptr %12, align 16 + %13 = call i64 @std.io.printfn(ptr %retparam4, ptr @.str.6, i64 16, ptr %varargslots5, i64 1) ret void } diff --git a/test/test_suite/errors/error_regression_2.c3t b/test/test_suite/errors/error_regression_2.c3t index 4ec58b136..940bf396c 100644 --- a/test/test_suite/errors/error_regression_2.c3t +++ b/test/test_suite/errors/error_regression_2.c3t @@ -168,7 +168,7 @@ cond.rhs: ; preds = %entry br label %cond.phi cond.phi: ; preds = %cond.rhs, %cond.lhs - %val = phi %"char[]" [ %6, %cond.lhs ], [ { ptr @.str.26, i64 7 }, %cond.rhs ] + %val = phi %"char[]" [ %6, %cond.lhs ], [ { ptr @.str.29, i64 7 }, %cond.rhs ] store %"char[]" %val, ptr %title, align 8 %7 = getelementptr inbounds %"char[]", ptr %title, i32 0, i32 1 %8 = load i64, ptr %7, align 8 @@ -178,8 +178,8 @@ cond.phi: ; preds = %cond.rhs, %cond.lhs %11 = getelementptr inbounds %Summary, ptr %0, i32 0, i32 1 %12 = load i8, ptr %11, align 8 %13 = trunc i8 %12 to i1 - %ternary = select i1 %13, ptr @.str.28, ptr @.str.29 - %14 = call i32 (ptr, ptr, ...) @fprintf(ptr %1, ptr @.str.27, i32 %trunc, ptr %10, ptr %ternary) + %ternary = select i1 %13, ptr @.str.31, ptr @.str.32 + %14 = call i32 (ptr, ptr, ...) @fprintf(ptr %1, ptr @.str.30, i32 %trunc, ptr %10, ptr %ternary) ret void } @@ -357,63 +357,61 @@ if.exit: ; preds = %entry br i1 %10, label %if.then3, label %if.exit4 if.then3: ; preds = %if.exit - %11 = getelementptr inbounds %Doc, ptr %literal, i32 0, i32 0 - store ptr null, ptr %11, align 8 + call void @llvm.memcpy.p0.p0.i32(ptr align 8 %literal, ptr align 8 @.__const, i32 8, i1 false) call void @llvm.memcpy.p0.p0.i32(ptr align 8 %0, ptr align 8 %literal, i32 8, i1 false) ret i64 0 if.exit4: ; preds = %if.exit - %12 = getelementptr inbounds %"char[]", ptr %url, i32 0, i32 0 - %lo5 = load ptr, ptr %12, align 8 - %13 = getelementptr inbounds %"char[]", ptr %url, i32 0, i32 1 - %hi6 = load i64, ptr %13, align 8 - %14 = call i8 @test.contains(ptr %lo5, i64 %hi6, ptr @.str.4, i64 13) - %15 = trunc i8 %14 to i1 - br i1 %15, label %if.then7, label %if.exit18 + %11 = getelementptr inbounds %"char[]", ptr %url, i32 0, i32 0 + %lo5 = load ptr, ptr %11, align 8 + %12 = getelementptr inbounds %"char[]", ptr %url, i32 0, i32 1 + %hi6 = load i64, ptr %12, align 8 + %13 = call i8 @test.contains(ptr %lo5, i64 %hi6, ptr @.str.4, i64 13) + %14 = trunc i8 %13 to i1 + br i1 %14, label %if.then7, label %if.exit18 if.then7: ; preds = %if.exit4 - %16 = getelementptr inbounds %Doc, ptr %literal9, i32 0, i32 0 - %17 = getelementptr inbounds %Head, ptr %literal10, i32 0, i32 0 - store ptr null, ptr %17, align 8 + %15 = getelementptr inbounds %Doc, ptr %literal9, i32 0, i32 0 + call void @llvm.memcpy.p0.p0.i32(ptr align 8 %literal10, ptr align 8 @.__const.5, i32 8, i1 false) call void @llvm.memcpy.p0.p0.i32(ptr align 8 %value, ptr align 8 %literal10, i32 8, i1 false) - %18 = load ptr, ptr @std.core.mem.thread_allocator, align 8 - store ptr %18, ptr %using, align 8 - %19 = load ptr, ptr %using, align 8 - store ptr %19, ptr %using12, align 8 - %20 = load ptr, ptr %using12, align 8 - store ptr %20, ptr %allocator, align 8 - %21 = load ptr, ptr %allocator, align 8 - %22 = getelementptr inbounds %Allocator, ptr %21, i32 0, i32 0 - %23 = load ptr, ptr %22, align 8 - %24 = load ptr, ptr %allocator, align 8 - %25 = call i64 %23(ptr %retparam, ptr %24, i64 8, i64 0, i64 0, ptr null, i32 0) - %not_err = icmp eq i64 %25, 0 - %26 = call i1 @llvm.expect.i1(i1 %not_err, i1 true) - br i1 %26, label %after_check, label %assign_optional + %16 = load ptr, ptr @std.core.mem.thread_allocator, align 8 + store ptr %16, ptr %using, align 8 + %17 = load ptr, ptr %using, align 8 + store ptr %17, ptr %using12, align 8 + %18 = load ptr, ptr %using12, align 8 + store ptr %18, ptr %allocator, align 8 + %19 = load ptr, ptr %allocator, align 8 + %20 = getelementptr inbounds %Allocator, ptr %19, i32 0, i32 0 + %21 = load ptr, ptr %20, align 8 + %22 = load ptr, ptr %allocator, align 8 + %23 = call i64 %21(ptr %retparam, ptr %22, i64 8, i64 0, i64 0, ptr null, i32 0) + %not_err = icmp eq i64 %23, 0 + %24 = call i1 @llvm.expect.i1(i1 %not_err, i1 true) + br i1 %24, label %after_check, label %assign_optional assign_optional: ; preds = %if.then7 - store i64 %25, ptr %error_var11, align 8 + store i64 %23, ptr %error_var11, align 8 br label %panic_block after_check: ; preds = %if.then7 - %27 = load ptr, ptr %retparam, align 8 + %25 = load ptr, ptr %retparam, align 8 br label %noerr_block panic_block: ; preds = %assign_optional - %28 = insertvalue %any undef, ptr %error_var11, 0 - %29 = insertvalue %any %28, i64 ptrtoint (ptr @"$ct.anyfault" to i64), 1 - %30 = getelementptr inbounds [1 x %any], ptr %varargslots, i64 0, i64 0 - store %any %29, ptr %30, align 16 - %31 = insertvalue %"any[]" undef, ptr %varargslots, 0 - %"#temp#" = insertvalue %"any[]" %31, i64 1, 1 + %26 = insertvalue %any undef, ptr %error_var11, 0 + %27 = insertvalue %any %26, i64 ptrtoint (ptr @"$ct.anyfault" to i64), 1 + %28 = getelementptr inbounds [1 x %any], ptr %varargslots, i64 0, i64 0 + store %any %27, ptr %28, align 16 + %29 = insertvalue %"any[]" undef, ptr %varargslots, 0 + %"#temp#" = insertvalue %"any[]" %29, i64 1, 1 store %"any[]" %"#temp#", ptr %indirectarg, align 8 call void @std.core.builtin.panicf(ptr @.panic_msg, i64 36, ptr @.file, i64 6, ptr @.func, i64 7, i32 204, ptr byval(%"any[]") align 8 %indirectarg) unreachable noerr_block: ; preds = %after_check - store ptr %27, ptr %temp, align 8 - %32 = load ptr, ptr %temp, align 8 - %not = icmp eq ptr %32, null + store ptr %25, ptr %temp, align 8 + %30 = load ptr, ptr %temp, align 8 + %not = icmp eq ptr %30, null br i1 %not, label %if.then15, label %if.exit16 if.then15: ; preds = %noerr_block @@ -421,72 +419,72 @@ if.then15: ; preds = %noerr_block br label %guard_block if.exit16: ; preds = %noerr_block - %33 = load ptr, ptr %temp, align 8 - call void @llvm.memcpy.p0.p0.i32(ptr align 8 %33, ptr align 8 %value, i32 8, i1 false) + %31 = load ptr, ptr %temp, align 8 + call void @llvm.memcpy.p0.p0.i32(ptr align 8 %31, ptr align 8 %value, i32 8, i1 false) br label %noerr_block17 guard_block: ; preds = %if.then15 - %34 = load i64, ptr %error_var, align 8 - ret i64 %34 + %32 = load i64, ptr %error_var, align 8 + ret i64 %32 noerr_block17: ; preds = %if.exit16 - %35 = load ptr, ptr %temp, align 8 - store ptr %35, ptr %16, align 8 + %33 = load ptr, ptr %temp, align 8 + store ptr %33, ptr %15, align 8 call void @llvm.memcpy.p0.p0.i32(ptr align 8 %0, ptr align 8 %literal9, i32 8, i1 false) ret i64 0 if.exit18: ; preds = %if.exit4 - %36 = getelementptr inbounds %"char[]", ptr %url, i32 0, i32 0 - %lo19 = load ptr, ptr %36, align 8 - %37 = getelementptr inbounds %"char[]", ptr %url, i32 0, i32 1 - %hi20 = load i64, ptr %37, align 8 - %38 = call i8 @test.contains(ptr %lo19, i64 %hi20, ptr @.str.5, i64 11) - %39 = trunc i8 %38 to i1 - br i1 %39, label %if.then21, label %if.exit71 + %34 = getelementptr inbounds %"char[]", ptr %url, i32 0, i32 0 + %lo19 = load ptr, ptr %34, align 8 + %35 = getelementptr inbounds %"char[]", ptr %url, i32 0, i32 1 + %hi20 = load i64, ptr %35, align 8 + %36 = call i8 @test.contains(ptr %lo19, i64 %hi20, ptr @.str.6, i64 11) + %37 = trunc i8 %36 to i1 + br i1 %37, label %if.then21, label %if.exit71 if.then21: ; preds = %if.exit18 - %40 = getelementptr inbounds %Doc, ptr %literal23, i32 0, i32 0 + %38 = getelementptr inbounds %Doc, ptr %literal23, i32 0, i32 0 store ptr null, ptr %literal25, align 8 - %41 = getelementptr inbounds %Head, ptr %literal25, i32 0, i32 0 + %39 = getelementptr inbounds %Head, ptr %literal25, i32 0, i32 0 store %"char[]" zeroinitializer, ptr %value27, align 8 - %42 = load ptr, ptr @std.core.mem.thread_allocator, align 8 - store ptr %42, ptr %using29, align 8 - %43 = load ptr, ptr %using29, align 8 - store ptr %43, ptr %using31, align 8 - %44 = load ptr, ptr %using31, align 8 - store ptr %44, ptr %allocator33, align 8 - %45 = load ptr, ptr %allocator33, align 8 - %46 = getelementptr inbounds %Allocator, ptr %45, i32 0, i32 0 - %47 = load ptr, ptr %46, align 8 - %48 = load ptr, ptr %allocator33, align 8 - %49 = call i64 %47(ptr %retparam35, ptr %48, i64 16, i64 0, i64 0, ptr null, i32 0) - %not_err36 = icmp eq i64 %49, 0 - %50 = call i1 @llvm.expect.i1(i1 %not_err36, i1 true) - br i1 %50, label %after_check38, label %assign_optional37 + %40 = load ptr, ptr @std.core.mem.thread_allocator, align 8 + store ptr %40, ptr %using29, align 8 + %41 = load ptr, ptr %using29, align 8 + store ptr %41, ptr %using31, align 8 + %42 = load ptr, ptr %using31, align 8 + store ptr %42, ptr %allocator33, align 8 + %43 = load ptr, ptr %allocator33, align 8 + %44 = getelementptr inbounds %Allocator, ptr %43, i32 0, i32 0 + %45 = load ptr, ptr %44, align 8 + %46 = load ptr, ptr %allocator33, align 8 + %47 = call i64 %45(ptr %retparam35, ptr %46, i64 16, i64 0, i64 0, ptr null, i32 0) + %not_err36 = icmp eq i64 %47, 0 + %48 = call i1 @llvm.expect.i1(i1 %not_err36, i1 true) + br i1 %48, label %after_check38, label %assign_optional37 assign_optional37: ; preds = %if.then21 - store i64 %49, ptr %error_var30, align 8 + store i64 %47, ptr %error_var30, align 8 br label %panic_block39 after_check38: ; preds = %if.then21 - %51 = load ptr, ptr %retparam35, align 8 + %49 = load ptr, ptr %retparam35, align 8 br label %noerr_block43 panic_block39: ; preds = %assign_optional37 - %52 = insertvalue %any undef, ptr %error_var30, 0 - %53 = insertvalue %any %52, i64 ptrtoint (ptr @"$ct.anyfault" to i64), 1 - %54 = getelementptr inbounds [1 x %any], ptr %varargslots40, i64 0, i64 0 - store %any %53, ptr %54, align 16 - %55 = insertvalue %"any[]" undef, ptr %varargslots40, 0 - %"#temp#41" = insertvalue %"any[]" %55, i64 1, 1 + %50 = insertvalue %any undef, ptr %error_var30, 0 + %51 = insertvalue %any %50, i64 ptrtoint (ptr @"$ct.anyfault" to i64), 1 + %52 = getelementptr inbounds [1 x %any], ptr %varargslots40, i64 0, i64 0 + store %any %51, ptr %52, align 16 + %53 = insertvalue %"any[]" undef, ptr %varargslots40, 0 + %"#temp#41" = insertvalue %"any[]" %53, i64 1, 1 store %"any[]" %"#temp#41", ptr %indirectarg42, align 8 call void @std.core.builtin.panicf(ptr @.panic_msg, i64 36, ptr @.file, i64 6, ptr @.func, i64 7, i32 204, ptr byval(%"any[]") align 8 %indirectarg42) unreachable noerr_block43: ; preds = %after_check38 - store ptr %51, ptr %temp28, align 8 - %56 = load ptr, ptr %temp28, align 8 - %not44 = icmp eq ptr %56, null + store ptr %49, ptr %temp28, align 8 + %54 = load ptr, ptr %temp28, align 8 + %not44 = icmp eq ptr %54, null br i1 %not44, label %if.then45, label %if.exit46 if.then45: ; preds = %noerr_block43 @@ -494,56 +492,56 @@ if.then45: ; preds = %noerr_block43 br label %guard_block47 if.exit46: ; preds = %noerr_block43 - %57 = load ptr, ptr %temp28, align 8 - call void @llvm.memcpy.p0.p0.i32(ptr align 8 %57, ptr align 8 %value27, i32 16, i1 false) + %55 = load ptr, ptr %temp28, align 8 + call void @llvm.memcpy.p0.p0.i32(ptr align 8 %55, ptr align 8 %value27, i32 16, i1 false) br label %noerr_block48 guard_block47: ; preds = %if.then45 - %58 = load i64, ptr %error_var26, align 8 - ret i64 %58 + %56 = load i64, ptr %error_var26, align 8 + ret i64 %56 noerr_block48: ; preds = %if.exit46 - %59 = load ptr, ptr %temp28, align 8 - store ptr %59, ptr %41, align 8 + %57 = load ptr, ptr %temp28, align 8 + store ptr %57, ptr %39, align 8 call void @llvm.memcpy.p0.p0.i32(ptr align 8 %value49, ptr align 8 %literal25, i32 8, i1 false) - %60 = load ptr, ptr @std.core.mem.thread_allocator, align 8 - store ptr %60, ptr %using51, align 8 - %61 = load ptr, ptr %using51, align 8 - store ptr %61, ptr %using53, align 8 - %62 = load ptr, ptr %using53, align 8 - store ptr %62, ptr %allocator55, align 8 - %63 = load ptr, ptr %allocator55, align 8 - %64 = getelementptr inbounds %Allocator, ptr %63, i32 0, i32 0 - %65 = load ptr, ptr %64, align 8 - %66 = load ptr, ptr %allocator55, align 8 - %67 = call i64 %65(ptr %retparam57, ptr %66, i64 8, i64 0, i64 0, ptr null, i32 0) - %not_err58 = icmp eq i64 %67, 0 - %68 = call i1 @llvm.expect.i1(i1 %not_err58, i1 true) - br i1 %68, label %after_check60, label %assign_optional59 + %58 = load ptr, ptr @std.core.mem.thread_allocator, align 8 + store ptr %58, ptr %using51, align 8 + %59 = load ptr, ptr %using51, align 8 + store ptr %59, ptr %using53, align 8 + %60 = load ptr, ptr %using53, align 8 + store ptr %60, ptr %allocator55, align 8 + %61 = load ptr, ptr %allocator55, align 8 + %62 = getelementptr inbounds %Allocator, ptr %61, i32 0, i32 0 + %63 = load ptr, ptr %62, align 8 + %64 = load ptr, ptr %allocator55, align 8 + %65 = call i64 %63(ptr %retparam57, ptr %64, i64 8, i64 0, i64 0, ptr null, i32 0) + %not_err58 = icmp eq i64 %65, 0 + %66 = call i1 @llvm.expect.i1(i1 %not_err58, i1 true) + br i1 %66, label %after_check60, label %assign_optional59 assign_optional59: ; preds = %noerr_block48 - store i64 %67, ptr %error_var52, align 8 + store i64 %65, ptr %error_var52, align 8 br label %panic_block61 after_check60: ; preds = %noerr_block48 - %69 = load ptr, ptr %retparam57, align 8 + %67 = load ptr, ptr %retparam57, align 8 br label %noerr_block65 panic_block61: ; preds = %assign_optional59 - %70 = insertvalue %any undef, ptr %error_var52, 0 - %71 = insertvalue %any %70, i64 ptrtoint (ptr @"$ct.anyfault" to i64), 1 - %72 = getelementptr inbounds [1 x %any], ptr %varargslots62, i64 0, i64 0 - store %any %71, ptr %72, align 16 - %73 = insertvalue %"any[]" undef, ptr %varargslots62, 0 - %"#temp#63" = insertvalue %"any[]" %73, i64 1, 1 + %68 = insertvalue %any undef, ptr %error_var52, 0 + %69 = insertvalue %any %68, i64 ptrtoint (ptr @"$ct.anyfault" to i64), 1 + %70 = getelementptr inbounds [1 x %any], ptr %varargslots62, i64 0, i64 0 + store %any %69, ptr %70, align 16 + %71 = insertvalue %"any[]" undef, ptr %varargslots62, 0 + %"#temp#63" = insertvalue %"any[]" %71, i64 1, 1 store %"any[]" %"#temp#63", ptr %indirectarg64, align 8 call void @std.core.builtin.panicf(ptr @.panic_msg, i64 36, ptr @.file, i64 6, ptr @.func, i64 7, i32 204, ptr byval(%"any[]") align 8 %indirectarg64) unreachable noerr_block65: ; preds = %after_check60 - store ptr %69, ptr %temp50, align 8 - %74 = load ptr, ptr %temp50, align 8 - %not66 = icmp eq ptr %74, null + store ptr %67, ptr %temp50, align 8 + %72 = load ptr, ptr %temp50, align 8 + %not66 = icmp eq ptr %72, null br i1 %not66, label %if.then67, label %if.exit68 if.then67: ; preds = %noerr_block65 @@ -551,137 +549,137 @@ if.then67: ; preds = %noerr_block65 br label %guard_block69 if.exit68: ; preds = %noerr_block65 - %75 = load ptr, ptr %temp50, align 8 - call void @llvm.memcpy.p0.p0.i32(ptr align 8 %75, ptr align 8 %value49, i32 8, i1 false) + %73 = load ptr, ptr %temp50, align 8 + call void @llvm.memcpy.p0.p0.i32(ptr align 8 %73, ptr align 8 %value49, i32 8, i1 false) br label %noerr_block70 guard_block69: ; preds = %if.then67 - %76 = load i64, ptr %error_var24, align 8 - ret i64 %76 + %74 = load i64, ptr %error_var24, align 8 + ret i64 %74 noerr_block70: ; preds = %if.exit68 - %77 = load ptr, ptr %temp50, align 8 - store ptr %77, ptr %40, align 8 + %75 = load ptr, ptr %temp50, align 8 + store ptr %75, ptr %38, align 8 call void @llvm.memcpy.p0.p0.i32(ptr align 8 %0, ptr align 8 %literal23, i32 8, i1 false) ret i64 0 if.exit71: ; preds = %if.exit18 - %78 = getelementptr inbounds %"char[]", ptr %url, i32 0, i32 1 - %79 = load i64, ptr %78, align 8 - %trunc = trunc i64 %79 to i32 - %80 = getelementptr inbounds %"char[]", ptr %url, i32 0, i32 0 - %81 = load ptr, ptr %80, align 8 - %82 = call i32 (ptr, i64, ptr, ...) @snprintf(ptr null, i64 0, ptr @.str.6, i32 %trunc, ptr %81) - store i32 %82, ptr %len, align 4 - %83 = load ptr, ptr @std.core.mem.thread_allocator, align 8 - store ptr %83, ptr %using72, align 8 - %84 = load ptr, ptr %using72, align 8 - store ptr %84, ptr %using74, align 8 - %85 = load i32, ptr %len, align 4 - %add = add i32 %85, 1 - %86 = load ptr, ptr %using74, align 8 - store ptr %86, ptr %allocator75, align 8 + %76 = getelementptr inbounds %"char[]", ptr %url, i32 0, i32 1 + %77 = load i64, ptr %76, align 8 + %trunc = trunc i64 %77 to i32 + %78 = getelementptr inbounds %"char[]", ptr %url, i32 0, i32 0 + %79 = load ptr, ptr %78, align 8 + %80 = call i32 (ptr, i64, ptr, ...) @snprintf(ptr null, i64 0, ptr @.str.7, i32 %trunc, ptr %79) + store i32 %80, ptr %len, align 4 + %81 = load ptr, ptr @std.core.mem.thread_allocator, align 8 + store ptr %81, ptr %using72, align 8 + %82 = load ptr, ptr %using72, align 8 + store ptr %82, ptr %using74, align 8 + %83 = load i32, ptr %len, align 4 + %add = add i32 %83, 1 + %84 = load ptr, ptr %using74, align 8 + store ptr %84, ptr %allocator75, align 8 %sext = sext i32 %add to i64 %add76 = add i64 %sext, 0 - %87 = load ptr, ptr %allocator75, align 8 - %88 = getelementptr inbounds %Allocator, ptr %87, i32 0, i32 0 - %89 = load ptr, ptr %88, align 8 - %90 = load ptr, ptr %allocator75, align 8 - %91 = call i64 %89(ptr %retparam77, ptr %90, i64 %add76, i64 0, i64 0, ptr null, i32 0) - %not_err78 = icmp eq i64 %91, 0 - %92 = call i1 @llvm.expect.i1(i1 %not_err78, i1 true) - br i1 %92, label %after_check80, label %assign_optional79 + %85 = load ptr, ptr %allocator75, align 8 + %86 = getelementptr inbounds %Allocator, ptr %85, i32 0, i32 0 + %87 = load ptr, ptr %86, align 8 + %88 = load ptr, ptr %allocator75, align 8 + %89 = call i64 %87(ptr %retparam77, ptr %88, i64 %add76, i64 0, i64 0, ptr null, i32 0) + %not_err78 = icmp eq i64 %89, 0 + %90 = call i1 @llvm.expect.i1(i1 %not_err78, i1 true) + br i1 %90, label %after_check80, label %assign_optional79 assign_optional79: ; preds = %if.exit71 - store i64 %91, ptr %error_var73, align 8 + store i64 %89, ptr %error_var73, align 8 br label %panic_block81 after_check80: ; preds = %if.exit71 - %93 = load ptr, ptr %retparam77, align 8 + %91 = load ptr, ptr %retparam77, align 8 br label %noerr_block85 panic_block81: ; preds = %assign_optional79 - %94 = insertvalue %any undef, ptr %error_var73, 0 - %95 = insertvalue %any %94, i64 ptrtoint (ptr @"$ct.anyfault" to i64), 1 - %96 = getelementptr inbounds [1 x %any], ptr %varargslots82, i64 0, i64 0 - store %any %95, ptr %96, align 16 - %97 = insertvalue %"any[]" undef, ptr %varargslots82, 0 - %"#temp#83" = insertvalue %"any[]" %97, i64 1, 1 + %92 = insertvalue %any undef, ptr %error_var73, 0 + %93 = insertvalue %any %92, i64 ptrtoint (ptr @"$ct.anyfault" to i64), 1 + %94 = getelementptr inbounds [1 x %any], ptr %varargslots82, i64 0, i64 0 + store %any %93, ptr %94, align 16 + %95 = insertvalue %"any[]" undef, ptr %varargslots82, 0 + %"#temp#83" = insertvalue %"any[]" %95, i64 1, 1 store %"any[]" %"#temp#83", ptr %indirectarg84, align 8 call void @std.core.builtin.panicf(ptr @.panic_msg, i64 36, ptr @.file, i64 6, ptr @.func, i64 7, i32 204, ptr byval(%"any[]") align 8 %indirectarg84) unreachable noerr_block85: ; preds = %after_check80 - store ptr %93, ptr %str, align 8 - %98 = load ptr, ptr %str, align 8 - %not86 = icmp eq ptr %98, null + store ptr %91, ptr %str, align 8 + %96 = load ptr, ptr %str, align 8 + %not86 = icmp eq ptr %96, null br i1 %not86, label %if.then87, label %if.exit88 if.then87: ; preds = %noerr_block85 ret i64 ptrtoint (ptr @"test.ReadError$OUT_OF_MEMORY" to i64) if.exit88: ; preds = %noerr_block85 - %99 = load ptr, ptr %str, align 8 - %100 = load i32, ptr %len, align 4 - %sext89 = sext i32 %100 to i64 + %97 = load ptr, ptr %str, align 8 + %98 = load i32, ptr %len, align 4 + %sext89 = sext i32 %98 to i64 %add90 = add i64 %sext89, 1 - %101 = getelementptr inbounds %"char[]", ptr %url, i32 0, i32 1 - %102 = load i64, ptr %101, align 8 - %trunc91 = trunc i64 %102 to i32 - %103 = getelementptr inbounds %"char[]", ptr %url, i32 0, i32 0 - %104 = load ptr, ptr %103, align 8 - %105 = call i32 (ptr, i64, ptr, ...) @snprintf(ptr %99, i64 %add90, ptr @.str.7, i32 %trunc91, ptr %104) - %106 = getelementptr inbounds %Doc, ptr %literal93, i32 0, i32 0 + %99 = getelementptr inbounds %"char[]", ptr %url, i32 0, i32 1 + %100 = load i64, ptr %99, align 8 + %trunc91 = trunc i64 %100 to i32 + %101 = getelementptr inbounds %"char[]", ptr %url, i32 0, i32 0 + %102 = load ptr, ptr %101, align 8 + %103 = call i32 (ptr, i64, ptr, ...) @snprintf(ptr %97, i64 %add90, ptr @.str.8, i32 %trunc91, ptr %102) + %104 = getelementptr inbounds %Doc, ptr %literal93, i32 0, i32 0 store ptr null, ptr %literal95, align 8 - %107 = getelementptr inbounds %Head, ptr %literal95, i32 0, i32 0 - %108 = load ptr, ptr %str, align 8 - %109 = load i32, ptr %len, align 4 - %sub = sub i32 %109, 1 + %105 = getelementptr inbounds %Head, ptr %literal95, i32 0, i32 0 + %106 = load ptr, ptr %str, align 8 + %107 = load i32, ptr %len, align 4 + %sub = sub i32 %107, 1 %sext97 = sext i32 %sub to i64 - %110 = add i64 %sext97, 1 - %size = sub i64 %110, 0 - %ptroffset98 = getelementptr inbounds i8, ptr %108, i64 0 - %111 = insertvalue %"char[]" undef, ptr %ptroffset98, 0 - %112 = insertvalue %"char[]" %111, i64 %size, 1 - store %"char[]" %112, ptr %value99, align 8 - %113 = load ptr, ptr @std.core.mem.thread_allocator, align 8 - store ptr %113, ptr %using101, align 8 - %114 = load ptr, ptr %using101, align 8 - store ptr %114, ptr %using103, align 8 - %115 = load ptr, ptr %using103, align 8 - store ptr %115, ptr %allocator105, align 8 - %116 = load ptr, ptr %allocator105, align 8 - %117 = getelementptr inbounds %Allocator, ptr %116, i32 0, i32 0 - %118 = load ptr, ptr %117, align 8 - %119 = load ptr, ptr %allocator105, align 8 - %120 = call i64 %118(ptr %retparam107, ptr %119, i64 16, i64 0, i64 0, ptr null, i32 0) - %not_err108 = icmp eq i64 %120, 0 - %121 = call i1 @llvm.expect.i1(i1 %not_err108, i1 true) - br i1 %121, label %after_check110, label %assign_optional109 + %108 = add i64 %sext97, 1 + %size = sub i64 %108, 0 + %ptroffset98 = getelementptr inbounds i8, ptr %106, i64 0 + %109 = insertvalue %"char[]" undef, ptr %ptroffset98, 0 + %110 = insertvalue %"char[]" %109, i64 %size, 1 + store %"char[]" %110, ptr %value99, align 8 + %111 = load ptr, ptr @std.core.mem.thread_allocator, align 8 + store ptr %111, ptr %using101, align 8 + %112 = load ptr, ptr %using101, align 8 + store ptr %112, ptr %using103, align 8 + %113 = load ptr, ptr %using103, align 8 + store ptr %113, ptr %allocator105, align 8 + %114 = load ptr, ptr %allocator105, align 8 + %115 = getelementptr inbounds %Allocator, ptr %114, i32 0, i32 0 + %116 = load ptr, ptr %115, align 8 + %117 = load ptr, ptr %allocator105, align 8 + %118 = call i64 %116(ptr %retparam107, ptr %117, i64 16, i64 0, i64 0, ptr null, i32 0) + %not_err108 = icmp eq i64 %118, 0 + %119 = call i1 @llvm.expect.i1(i1 %not_err108, i1 true) + br i1 %119, label %after_check110, label %assign_optional109 assign_optional109: ; preds = %if.exit88 - store i64 %120, ptr %error_var102, align 8 + store i64 %118, ptr %error_var102, align 8 br label %panic_block111 after_check110: ; preds = %if.exit88 - %122 = load ptr, ptr %retparam107, align 8 + %120 = load ptr, ptr %retparam107, align 8 br label %noerr_block115 panic_block111: ; preds = %assign_optional109 - %123 = insertvalue %any undef, ptr %error_var102, 0 - %124 = insertvalue %any %123, i64 ptrtoint (ptr @"$ct.anyfault" to i64), 1 - %125 = getelementptr inbounds [1 x %any], ptr %varargslots112, i64 0, i64 0 - store %any %124, ptr %125, align 16 - %126 = insertvalue %"any[]" undef, ptr %varargslots112, 0 - %"#temp#113" = insertvalue %"any[]" %126, i64 1, 1 + %121 = insertvalue %any undef, ptr %error_var102, 0 + %122 = insertvalue %any %121, i64 ptrtoint (ptr @"$ct.anyfault" to i64), 1 + %123 = getelementptr inbounds [1 x %any], ptr %varargslots112, i64 0, i64 0 + store %any %122, ptr %123, align 16 + %124 = insertvalue %"any[]" undef, ptr %varargslots112, 0 + %"#temp#113" = insertvalue %"any[]" %124, i64 1, 1 store %"any[]" %"#temp#113", ptr %indirectarg114, align 8 call void @std.core.builtin.panicf(ptr @.panic_msg, i64 36, ptr @.file, i64 6, ptr @.func, i64 7, i32 204, ptr byval(%"any[]") align 8 %indirectarg114) unreachable noerr_block115: ; preds = %after_check110 - store ptr %122, ptr %temp100, align 8 - %127 = load ptr, ptr %temp100, align 8 - %not116 = icmp eq ptr %127, null + store ptr %120, ptr %temp100, align 8 + %125 = load ptr, ptr %temp100, align 8 + %not116 = icmp eq ptr %125, null br i1 %not116, label %if.then117, label %if.exit118 if.then117: ; preds = %noerr_block115 @@ -689,56 +687,56 @@ if.then117: ; preds = %noerr_block115 br label %guard_block119 if.exit118: ; preds = %noerr_block115 - %128 = load ptr, ptr %temp100, align 8 - call void @llvm.memcpy.p0.p0.i32(ptr align 8 %128, ptr align 8 %value99, i32 16, i1 false) + %126 = load ptr, ptr %temp100, align 8 + call void @llvm.memcpy.p0.p0.i32(ptr align 8 %126, ptr align 8 %value99, i32 16, i1 false) br label %noerr_block120 guard_block119: ; preds = %if.then117 - %129 = load i64, ptr %error_var96, align 8 - ret i64 %129 + %127 = load i64, ptr %error_var96, align 8 + ret i64 %127 noerr_block120: ; preds = %if.exit118 - %130 = load ptr, ptr %temp100, align 8 - store ptr %130, ptr %107, align 8 + %128 = load ptr, ptr %temp100, align 8 + store ptr %128, ptr %105, align 8 call void @llvm.memcpy.p0.p0.i32(ptr align 8 %value121, ptr align 8 %literal95, i32 8, i1 false) - %131 = load ptr, ptr @std.core.mem.thread_allocator, align 8 - store ptr %131, ptr %using123, align 8 - %132 = load ptr, ptr %using123, align 8 - store ptr %132, ptr %using125, align 8 - %133 = load ptr, ptr %using125, align 8 - store ptr %133, ptr %allocator127, align 8 - %134 = load ptr, ptr %allocator127, align 8 - %135 = getelementptr inbounds %Allocator, ptr %134, i32 0, i32 0 - %136 = load ptr, ptr %135, align 8 - %137 = load ptr, ptr %allocator127, align 8 - %138 = call i64 %136(ptr %retparam129, ptr %137, i64 8, i64 0, i64 0, ptr null, i32 0) - %not_err130 = icmp eq i64 %138, 0 - %139 = call i1 @llvm.expect.i1(i1 %not_err130, i1 true) - br i1 %139, label %after_check132, label %assign_optional131 + %129 = load ptr, ptr @std.core.mem.thread_allocator, align 8 + store ptr %129, ptr %using123, align 8 + %130 = load ptr, ptr %using123, align 8 + store ptr %130, ptr %using125, align 8 + %131 = load ptr, ptr %using125, align 8 + store ptr %131, ptr %allocator127, align 8 + %132 = load ptr, ptr %allocator127, align 8 + %133 = getelementptr inbounds %Allocator, ptr %132, i32 0, i32 0 + %134 = load ptr, ptr %133, align 8 + %135 = load ptr, ptr %allocator127, align 8 + %136 = call i64 %134(ptr %retparam129, ptr %135, i64 8, i64 0, i64 0, ptr null, i32 0) + %not_err130 = icmp eq i64 %136, 0 + %137 = call i1 @llvm.expect.i1(i1 %not_err130, i1 true) + br i1 %137, label %after_check132, label %assign_optional131 assign_optional131: ; preds = %noerr_block120 - store i64 %138, ptr %error_var124, align 8 + store i64 %136, ptr %error_var124, align 8 br label %panic_block133 after_check132: ; preds = %noerr_block120 - %140 = load ptr, ptr %retparam129, align 8 + %138 = load ptr, ptr %retparam129, align 8 br label %noerr_block137 panic_block133: ; preds = %assign_optional131 - %141 = insertvalue %any undef, ptr %error_var124, 0 - %142 = insertvalue %any %141, i64 ptrtoint (ptr @"$ct.anyfault" to i64), 1 - %143 = getelementptr inbounds [1 x %any], ptr %varargslots134, i64 0, i64 0 - store %any %142, ptr %143, align 16 - %144 = insertvalue %"any[]" undef, ptr %varargslots134, 0 - %"#temp#135" = insertvalue %"any[]" %144, i64 1, 1 + %139 = insertvalue %any undef, ptr %error_var124, 0 + %140 = insertvalue %any %139, i64 ptrtoint (ptr @"$ct.anyfault" to i64), 1 + %141 = getelementptr inbounds [1 x %any], ptr %varargslots134, i64 0, i64 0 + store %any %140, ptr %141, align 16 + %142 = insertvalue %"any[]" undef, ptr %varargslots134, 0 + %"#temp#135" = insertvalue %"any[]" %142, i64 1, 1 store %"any[]" %"#temp#135", ptr %indirectarg136, align 8 call void @std.core.builtin.panicf(ptr @.panic_msg, i64 36, ptr @.file, i64 6, ptr @.func, i64 7, i32 204, ptr byval(%"any[]") align 8 %indirectarg136) unreachable noerr_block137: ; preds = %after_check132 - store ptr %140, ptr %temp122, align 8 - %145 = load ptr, ptr %temp122, align 8 - %not138 = icmp eq ptr %145, null + store ptr %138, ptr %temp122, align 8 + %143 = load ptr, ptr %temp122, align 8 + %not138 = icmp eq ptr %143, null br i1 %not138, label %if.then139, label %if.exit140 if.then139: ; preds = %noerr_block137 @@ -746,17 +744,17 @@ if.then139: ; preds = %noerr_block137 br label %guard_block141 if.exit140: ; preds = %noerr_block137 - %146 = load ptr, ptr %temp122, align 8 - call void @llvm.memcpy.p0.p0.i32(ptr align 8 %146, ptr align 8 %value121, i32 8, i1 false) + %144 = load ptr, ptr %temp122, align 8 + call void @llvm.memcpy.p0.p0.i32(ptr align 8 %144, ptr align 8 %value121, i32 8, i1 false) br label %noerr_block142 guard_block141: ; preds = %if.then139 - %147 = load i64, ptr %error_var94, align 8 - ret i64 %147 + %145 = load i64, ptr %error_var94, align 8 + ret i64 %145 noerr_block142: ; preds = %if.exit140 - %148 = load ptr, ptr %temp122, align 8 - store ptr %148, ptr %106, align 8 + %146 = load ptr, ptr %temp122, align 8 + store ptr %146, ptr %104, align 8 call void @llvm.memcpy.p0.p0.i32(ptr align 8 %0, ptr align 8 %literal93, i32 8, i1 false) ret i64 0 } @@ -824,18 +822,15 @@ after_check: ; preds = %entry br label %phi_block else_block: ; preds = %entry - %9 = getelementptr inbounds %Summary, ptr %literal, i32 0, i32 0 - store ptr null, ptr %9, align 8 - %10 = getelementptr inbounds %Summary, ptr %literal, i32 0, i32 1 - store i8 0, ptr %10, align 8 - %11 = load %Summary, ptr %literal, align 8 + call void @llvm.memcpy.p0.p0.i32(ptr align 8 %literal, ptr align 8 @.__const.9, i32 16, i1 false) + %9 = load %Summary, ptr %literal, align 8 br label %phi_block phi_block: ; preds = %else_block, %after_check - %val = phi %Summary [ %8, %after_check ], [ %11, %else_block ] + %val = phi %Summary [ %8, %after_check ], [ %9, %else_block ] store %Summary %val, ptr %taddr, align 8 - %12 = load { ptr, i8 }, ptr %taddr, align 8 - ret { ptr, i8 } %12 + %10 = load { ptr, i8 }, ptr %taddr, align 8 + ret { ptr, i8 } %10 } ; Function Attrs: nounwind @@ -924,7 +919,7 @@ err_retblock: ; preds = %assign_optional3, % define ptr @test.bool_to_string(i8 zeroext %0) #0 { entry: %1 = trunc i8 %0 to i1 - %ternary = select i1 %1, %"char[]" { ptr @.str.8, i64 4 }, %"char[]" { ptr @.str.9, i64 5 } + %ternary = select i1 %1, %"char[]" { ptr @.str.10, i64 4 }, %"char[]" { ptr @.str.11, i64 5 } %2 = extractvalue %"char[]" %ternary, 0 ret ptr %2 } @@ -942,27 +937,27 @@ switch.entry: ; preds = %entry br i1 %eq, label %switch.case, label %next_if switch.case: ; preds = %switch.entry - ret ptr @.str.10 + ret ptr @.str.12 next_if: ; preds = %switch.entry %eq1 = icmp eq i64 ptrtoint (ptr @"test.ReadError$BAD_READ" to i64), %1 br i1 %eq1, label %switch.case2, label %next_if3 switch.case2: ; preds = %next_if - ret ptr @.str.11 + ret ptr @.str.13 next_if3: ; preds = %next_if %eq4 = icmp eq i64 ptrtoint (ptr @"test.ReadError$OUT_OF_MEMORY" to i64), %1 br i1 %eq4, label %switch.case5, label %next_if6 switch.case5: ; preds = %next_if3 - ret ptr @.str.12 + ret ptr @.str.14 next_if6: ; preds = %next_if3 br label %switch.default switch.default: ; preds = %next_if6 - ret ptr @.str.13 + ret ptr @.str.15 } ; Function Attrs: nounwind @@ -981,105 +976,96 @@ entry: %retparam = alloca i8, align 1 %blockret = alloca i64, align 8 %f = alloca i64, align 8 - %0 = getelementptr inbounds [5 x %"char[]"], ptr %literal, i64 0, i64 0 - store %"char[]" { ptr @.str.14, i64 4 }, ptr %0, align 8 - %1 = getelementptr inbounds [5 x %"char[]"], ptr %literal, i64 0, i64 1 - store %"char[]" { ptr @.str.15, i64 11 }, ptr %1, align 8 - %2 = getelementptr inbounds [5 x %"char[]"], ptr %literal, i64 0, i64 2 - store %"char[]" { ptr @.str.16, i64 13 }, ptr %2, align 8 - %3 = getelementptr inbounds [5 x %"char[]"], ptr %literal, i64 0, i64 3 - store %"char[]" { ptr @.str.17, i64 12 }, ptr %3, align 8 - %4 = getelementptr inbounds [5 x %"char[]"], ptr %literal, i64 0, i64 4 - store %"char[]" { ptr @.str.18, i64 4 }, ptr %4, align 8 - %5 = insertvalue %"char[][]" undef, ptr %literal, 0 - %6 = insertvalue %"char[][]" %5, i64 5, 1 - store %"char[][]" %6, ptr %URLS, align 8 - %7 = getelementptr inbounds %"char[][]", ptr %URLS, i32 0, i32 1 - %8 = load i64, ptr %7, align 8 - store i64 %8, ptr %.anon, align 8 + call void @llvm.memcpy.p0.p0.i32(ptr align 8 %literal, ptr align 16 @.__const.21, i32 80, i1 false) + %0 = insertvalue %"char[][]" undef, ptr %literal, 0 + %1 = insertvalue %"char[][]" %0, i64 5, 1 + store %"char[][]" %1, ptr %URLS, align 8 + %2 = getelementptr inbounds %"char[][]", ptr %URLS, i32 0, i32 1 + %3 = load i64, ptr %2, align 8 + store i64 %3, ptr %.anon, align 8 store i64 0, ptr %.anon1, align 8 br label %loop.cond loop.cond: ; preds = %phi_block16, %entry - %9 = load i64, ptr %.anon1, align 8 - %10 = load i64, ptr %.anon, align 8 - %lt = icmp ult i64 %9, %10 + %4 = load i64, ptr %.anon1, align 8 + %5 = load i64, ptr %.anon, align 8 + %lt = icmp ult i64 %4, %5 br i1 %lt, label %loop.body, label %loop.exit loop.body: ; preds = %loop.cond - %11 = getelementptr inbounds %"char[][]", ptr %URLS, i32 0, i32 0 - %12 = load ptr, ptr %11, align 8 - %13 = load i64, ptr %.anon1, align 8 - %ptroffset = getelementptr inbounds %"char[]", ptr %12, i64 %13 + %6 = getelementptr inbounds %"char[][]", ptr %URLS, i32 0, i32 0 + %7 = load ptr, ptr %6, align 8 + %8 = load i64, ptr %.anon1, align 8 + %ptroffset = getelementptr inbounds %"char[]", ptr %7, i64 %8 call void @llvm.memcpy.p0.p0.i32(ptr align 8 %url, ptr align 8 %ptroffset, i32 16, i1 false) - %14 = getelementptr inbounds %"char[]", ptr %url, i32 0, i32 1 - %15 = load i64, ptr %14, align 8 - %trunc = trunc i64 %15 to i32 - %16 = getelementptr inbounds %"char[]", ptr %url, i32 0, i32 0 - %17 = load ptr, ptr %16, align 8 - %18 = call i32 (ptr, ...) @printf(ptr @.str.19, i32 %trunc, ptr %17) - %19 = getelementptr inbounds %"char[]", ptr %url, i32 0, i32 0 - %lo = load ptr, ptr %19, align 8 - %20 = getelementptr inbounds %"char[]", ptr %url, i32 0, i32 1 - %hi = load i64, ptr %20, align 8 - %21 = call { ptr, i8 } @test.readAndBuildSummary(ptr %lo, i64 %hi) - store { ptr, i8 } %21, ptr %result, align 8 + %9 = getelementptr inbounds %"char[]", ptr %url, i32 0, i32 1 + %10 = load i64, ptr %9, align 8 + %trunc = trunc i64 %10 to i32 + %11 = getelementptr inbounds %"char[]", ptr %url, i32 0, i32 0 + %12 = load ptr, ptr %11, align 8 + %13 = call i32 (ptr, ...) @printf(ptr @.str.22, i32 %trunc, ptr %12) + %14 = getelementptr inbounds %"char[]", ptr %url, i32 0, i32 0 + %lo = load ptr, ptr %14, align 8 + %15 = getelementptr inbounds %"char[]", ptr %url, i32 0, i32 1 + %hi = load i64, ptr %15, align 8 + %16 = call { ptr, i8 } @test.readAndBuildSummary(ptr %lo, i64 %hi) + store { ptr, i8 } %16, ptr %result, align 8 call void @llvm.memcpy.p0.p0.i32(ptr align 8 %summary, ptr align 8 %result, i32 16, i1 false) - %22 = call i32 (ptr, ...) @printf(ptr @.str.20) - %23 = load ptr, ptr @__stdoutp, align 8 - call void @test.Summary.print(ptr %summary, ptr %23) - %24 = call i32 (ptr, ...) @printf(ptr @.str.21) - %25 = getelementptr inbounds %Summary, ptr %summary, i32 0, i32 0 - %26 = load ptr, ptr %25, align 8 - %ptrbool = icmp ne ptr %26, null + %17 = call i32 (ptr, ...) @printf(ptr @.str.23) + %18 = load ptr, ptr @__stdoutp, align 8 + call void @test.Summary.print(ptr %summary, ptr %18) + %19 = call i32 (ptr, ...) @printf(ptr @.str.24) + %20 = getelementptr inbounds %Summary, ptr %summary, i32 0, i32 0 + %21 = load ptr, ptr %20, align 8 + %ptrbool = icmp ne ptr %21, null br i1 %ptrbool, label %cond.lhs, label %cond.rhs cond.lhs: ; preds = %loop.body - %27 = getelementptr inbounds %Summary, ptr %summary, i32 0, i32 0 - %28 = load ptr, ptr %27, align 8 - %29 = load %"char[]", ptr %28, align 8 + %22 = getelementptr inbounds %Summary, ptr %summary, i32 0, i32 0 + %23 = load ptr, ptr %22, align 8 + %24 = load %"char[]", ptr %23, align 8 br label %cond.phi cond.rhs: ; preds = %loop.body br label %cond.phi cond.phi: ; preds = %cond.rhs, %cond.lhs - %val = phi %"char[]" [ %29, %cond.lhs ], [ zeroinitializer, %cond.rhs ] + %val = phi %"char[]" [ %24, %cond.lhs ], [ zeroinitializer, %cond.rhs ] store %"char[]" %val, ptr %title_sure, align 8 - %30 = getelementptr inbounds %"char[]", ptr %title_sure, i32 0, i32 1 - %31 = load i64, ptr %30, align 8 - %trunc2 = trunc i64 %31 to i32 - %32 = getelementptr inbounds %"char[]", ptr %title_sure, i32 0, i32 0 - %33 = load ptr, ptr %32, align 8 - %34 = call i32 (ptr, ...) @printf(ptr @.str.22, i32 %trunc2, ptr %33) - %35 = getelementptr inbounds %"char[]", ptr %url, i32 0, i32 0 - %lo3 = load ptr, ptr %35, align 8 - %36 = getelementptr inbounds %"char[]", ptr %url, i32 0, i32 1 - %hi4 = load i64, ptr %36, align 8 - %37 = call i64 @test.readWhetherTitleNonEmpty(ptr %retparam, ptr %lo3, i64 %hi4) - %not_err = icmp eq i64 %37, 0 - %38 = call i1 @llvm.expect.i1(i1 %not_err, i1 true) - br i1 %38, label %after_check, label %assign_optional + %25 = getelementptr inbounds %"char[]", ptr %title_sure, i32 0, i32 1 + %26 = load i64, ptr %25, align 8 + %trunc2 = trunc i64 %26 to i32 + %27 = getelementptr inbounds %"char[]", ptr %title_sure, i32 0, i32 0 + %28 = load ptr, ptr %27, align 8 + %29 = call i32 (ptr, ...) @printf(ptr @.str.25, i32 %trunc2, ptr %28) + %30 = getelementptr inbounds %"char[]", ptr %url, i32 0, i32 0 + %lo3 = load ptr, ptr %30, align 8 + %31 = getelementptr inbounds %"char[]", ptr %url, i32 0, i32 1 + %hi4 = load i64, ptr %31, align 8 + %32 = call i64 @test.readWhetherTitleNonEmpty(ptr %retparam, ptr %lo3, i64 %hi4) + %not_err = icmp eq i64 %32, 0 + %33 = call i1 @llvm.expect.i1(i1 %not_err, i1 true) + br i1 %33, label %after_check, label %assign_optional assign_optional: ; preds = %cond.phi - store i64 %37, ptr %has_title.f, align 8 + store i64 %32, ptr %has_title.f, align 8 br label %after_assign after_check: ; preds = %cond.phi - %39 = load i8, ptr %retparam, align 1 - store i8 %39, ptr %has_title, align 1 + %34 = load i8, ptr %retparam, align 1 + store i8 %34, ptr %has_title, align 1 store i64 0, ptr %has_title.f, align 8 br label %after_assign after_assign: ; preds = %after_check, %assign_optional %optval = load i64, ptr %has_title.f, align 8 %not_err5 = icmp eq i64 %optval, 0 - %40 = call i1 @llvm.expect.i1(i1 %not_err5, i1 true) - br i1 %40, label %after_check6, label %else_block + %35 = call i1 @llvm.expect.i1(i1 %not_err5, i1 true) + br i1 %35, label %after_check6, label %else_block after_check6: ; preds = %after_assign - %41 = load i8, ptr %has_title, align 1 - %42 = call ptr @test.bool_to_string(i8 zeroext %41) + %36 = load i8, ptr %has_title, align 1 + %37 = call ptr @test.bool_to_string(i8 zeroext %36) br label %phi_block else_block: ; preds = %after_assign @@ -1088,8 +1074,8 @@ else_block: ; preds = %after_assign testblock: ; preds = %else_block %optval7 = load i64, ptr %has_title.f, align 8 %not_err8 = icmp eq i64 %optval7, 0 - %43 = call i1 @llvm.expect.i1(i1 %not_err8, i1 true) - br i1 %43, label %after_check10, label %assign_optional9 + %38 = call i1 @llvm.expect.i1(i1 %not_err8, i1 true) + br i1 %38, label %after_check10, label %assign_optional9 assign_optional9: ; preds = %testblock store i64 %optval7, ptr %f, align 8 @@ -1100,13 +1086,13 @@ after_check10: ; preds = %testblock br label %end_block end_block: ; preds = %after_check10, %assign_optional9 - %44 = load i64, ptr %f, align 8 - %neq = icmp ne i64 %44, 0 + %39 = load i64, ptr %f, align 8 + %neq = icmp ne i64 %39, 0 br i1 %neq, label %if.then, label %if.exit if.then: ; preds = %end_block - %45 = load i64, ptr %f, align 8 - store i64 %45, ptr %blockret, align 8 + %40 = load i64, ptr %f, align 8 + store i64 %40, ptr %blockret, align 8 br label %expr_block.exit if.exit: ; preds = %end_block @@ -1114,31 +1100,31 @@ if.exit: ; preds = %end_block br label %expr_block.exit expr_block.exit: ; preds = %if.exit, %if.then - %46 = load i64, ptr %blockret, align 8 - %47 = call ptr @test.nameFromError(i64 %46) + %41 = load i64, ptr %blockret, align 8 + %42 = call ptr @test.nameFromError(i64 %41) br label %phi_block phi_block: ; preds = %expr_block.exit, %after_check6 - %val11 = phi ptr [ %42, %after_check6 ], [ %47, %expr_block.exit ] + %val11 = phi ptr [ %37, %after_check6 ], [ %42, %expr_block.exit ] %optval12 = load i64, ptr %has_title.f, align 8 %not_err13 = icmp eq i64 %optval12, 0 - %48 = call i1 @llvm.expect.i1(i1 %not_err13, i1 true) - br i1 %48, label %after_check14, label %else_block15 + %43 = call i1 @llvm.expect.i1(i1 %not_err13, i1 true) + br i1 %43, label %after_check14, label %else_block15 after_check14: ; preds = %phi_block - %49 = load i8, ptr %has_title, align 1 - %50 = trunc i8 %49 to i1 + %44 = load i8, ptr %has_title, align 1 + %45 = trunc i8 %44 to i1 br label %phi_block16 else_block15: ; preds = %phi_block br label %phi_block16 phi_block16: ; preds = %else_block15, %after_check14 - %val17 = phi i1 [ %50, %after_check14 ], [ false, %else_block15 ] - %ternary = select i1 %val17, ptr @.str.24, ptr @.str.25 - %51 = call i32 (ptr, ...) @printf(ptr @.str.23, ptr %val11, ptr %ternary) - %52 = load i64, ptr %.anon1, align 8 - %add = add i64 %52, 1 + %val17 = phi i1 [ %45, %after_check14 ], [ false, %else_block15 ] + %ternary = select i1 %val17, ptr @.str.27, ptr @.str.28 + %46 = call i32 (ptr, ...) @printf(ptr @.str.26, ptr %val11, ptr %ternary) + %47 = load i64, ptr %.anon1, align 8 + %add = add i64 %47, 1 store i64 %add, ptr %.anon1, align 8 br label %loop.cond diff --git a/test/test_suite/generic/generic_over_fn.c3t b/test/test_suite/generic/generic_over_fn.c3t index f0abd2994..7a213a6fb 100644 --- a/test/test_suite/generic/generic_over_fn.c3t +++ b/test/test_suite/generic/generic_over_fn.c3t @@ -74,77 +74,59 @@ entry: %0 = getelementptr inbounds [5 x %"int[]"], ptr %literal, i64 0, i64 0 store %"int[]" zeroinitializer, ptr %0, align 8 %1 = getelementptr inbounds [5 x %"int[]"], ptr %literal, i64 0, i64 1 - %2 = getelementptr inbounds [2 x i32], ptr %literal1, i64 0, i64 0 - store i32 10, ptr %2, align 4 - %3 = getelementptr inbounds [2 x i32], ptr %literal1, i64 0, i64 1 - store i32 3, ptr %3, align 4 - %4 = insertvalue %"int[]" undef, ptr %literal1, 0 - %5 = insertvalue %"int[]" %4, i64 2, 1 - store %"int[]" %5, ptr %1, align 8 - %6 = getelementptr inbounds [5 x %"int[]"], ptr %literal, i64 0, i64 2 - %7 = getelementptr inbounds [3 x i32], ptr %literal2, i64 0, i64 0 - store i32 3, ptr %7, align 4 - %8 = getelementptr inbounds [3 x i32], ptr %literal2, i64 0, i64 1 - store i32 2, ptr %8, align 4 - %9 = getelementptr inbounds [3 x i32], ptr %literal2, i64 0, i64 2 - store i32 1, ptr %9, align 4 - %10 = insertvalue %"int[]" undef, ptr %literal2, 0 - %11 = insertvalue %"int[]" %10, i64 3, 1 - store %"int[]" %11, ptr %6, align 8 - %12 = getelementptr inbounds [5 x %"int[]"], ptr %literal, i64 0, i64 3 - %13 = getelementptr inbounds [3 x i32], ptr %literal3, i64 0, i64 0 - store i32 1, ptr %13, align 4 - %14 = getelementptr inbounds [3 x i32], ptr %literal3, i64 0, i64 1 - store i32 2, ptr %14, align 4 - %15 = getelementptr inbounds [3 x i32], ptr %literal3, i64 0, i64 2 - store i32 3, ptr %15, align 4 - %16 = insertvalue %"int[]" undef, ptr %literal3, 0 - %17 = insertvalue %"int[]" %16, i64 3, 1 - store %"int[]" %17, ptr %12, align 8 - %18 = getelementptr inbounds [5 x %"int[]"], ptr %literal, i64 0, i64 4 - %19 = getelementptr inbounds [3 x i32], ptr %literal4, i64 0, i64 0 - store i32 2, ptr %19, align 4 - %20 = getelementptr inbounds [3 x i32], ptr %literal4, i64 0, i64 1 - store i32 1, ptr %20, align 4 - %21 = getelementptr inbounds [3 x i32], ptr %literal4, i64 0, i64 2 - store i32 3, ptr %21, align 4 - %22 = insertvalue %"int[]" undef, ptr %literal4, 0 - %23 = insertvalue %"int[]" %22, i64 3, 1 - store %"int[]" %23, ptr %18, align 8 - %24 = insertvalue %"int[][]" undef, ptr %literal, 0 - %25 = insertvalue %"int[][]" %24, i64 5, 1 - store %"int[][]" %25, ptr %tcases, align 8 - %26 = getelementptr inbounds %"int[][]", ptr %tcases, i32 0, i32 1 - %27 = load i64, ptr %26, align 8 - store i64 %27, ptr %.anon, align 8 + call void @llvm.memcpy.p0.p0.i32(ptr align 4 %literal1, ptr align 4 @.__const, i32 8, i1 false) + %2 = insertvalue %"int[]" undef, ptr %literal1, 0 + %3 = insertvalue %"int[]" %2, i64 2, 1 + store %"int[]" %3, ptr %1, align 8 + %4 = getelementptr inbounds [5 x %"int[]"], ptr %literal, i64 0, i64 2 + call void @llvm.memcpy.p0.p0.i32(ptr align 4 %literal2, ptr align 4 @.__const.1, i32 12, i1 false) + %5 = insertvalue %"int[]" undef, ptr %literal2, 0 + %6 = insertvalue %"int[]" %5, i64 3, 1 + store %"int[]" %6, ptr %4, align 8 + %7 = getelementptr inbounds [5 x %"int[]"], ptr %literal, i64 0, i64 3 + call void @llvm.memcpy.p0.p0.i32(ptr align 4 %literal3, ptr align 4 @.__const.2, i32 12, i1 false) + %8 = insertvalue %"int[]" undef, ptr %literal3, 0 + %9 = insertvalue %"int[]" %8, i64 3, 1 + store %"int[]" %9, ptr %7, align 8 + %10 = getelementptr inbounds [5 x %"int[]"], ptr %literal, i64 0, i64 4 + call void @llvm.memcpy.p0.p0.i32(ptr align 4 %literal4, ptr align 4 @.__const.3, i32 12, i1 false) + %11 = insertvalue %"int[]" undef, ptr %literal4, 0 + %12 = insertvalue %"int[]" %11, i64 3, 1 + store %"int[]" %12, ptr %10, align 8 + %13 = insertvalue %"int[][]" undef, ptr %literal, 0 + %14 = insertvalue %"int[][]" %13, i64 5, 1 + store %"int[][]" %14, ptr %tcases, align 8 + %15 = getelementptr inbounds %"int[][]", ptr %tcases, i32 0, i32 1 + %16 = load i64, ptr %15, align 8 + store i64 %16, ptr %.anon, align 8 store i64 0, ptr %.anon5, align 8 br label %loop.cond loop.cond: ; preds = %loop.body, %entry - %28 = load i64, ptr %.anon5, align 8 - %29 = load i64, ptr %.anon, align 8 - %lt = icmp ult i64 %28, %29 + %17 = load i64, ptr %.anon5, align 8 + %18 = load i64, ptr %.anon, align 8 + %lt = icmp ult i64 %17, %18 br i1 %lt, label %loop.body, label %loop.exit loop.body: ; preds = %loop.cond - %30 = getelementptr inbounds %"int[][]", ptr %tcases, i32 0, i32 0 - %31 = load ptr, ptr %30, align 8 - %32 = load i64, ptr %.anon5, align 8 - %ptroffset = getelementptr inbounds %"int[]", ptr %31, i64 %32 + %19 = getelementptr inbounds %"int[][]", ptr %tcases, i32 0, i32 0 + %20 = load ptr, ptr %19, align 8 + %21 = load i64, ptr %.anon5, align 8 + %ptroffset = getelementptr inbounds %"int[]", ptr %20, i64 %21 call void @llvm.memcpy.p0.p0.i32(ptr align 8 %tc, ptr align 8 %ptroffset, i32 16, i1 false) call void @llvm.memcpy.p0.p0.i32(ptr align 8 %list, ptr align 8 %tc, i32 16, i1 false) - %33 = getelementptr inbounds %"int[]", ptr %list, i32 0, i32 1 - %34 = load i64, ptr %33, align 8 - store i64 %34, ptr %len, align 8 - %35 = getelementptr inbounds %"int[]", ptr %list, i32 0, i32 0 - %lo = load ptr, ptr %35, align 8 - %36 = getelementptr inbounds %"int[]", ptr %list, i32 0, i32 1 - %hi = load i64, ptr %36, align 8 - %37 = load i64, ptr %len, align 8 - %sub = sub i64 %37, 1 + %22 = getelementptr inbounds %"int[]", ptr %list, i32 0, i32 1 + %23 = load i64, ptr %22, align 8 + store i64 %23, ptr %len, align 8 + %24 = getelementptr inbounds %"int[]", ptr %list, i32 0, i32 0 + %lo = load ptr, ptr %24, align 8 + %25 = getelementptr inbounds %"int[]", ptr %list, i32 0, i32 1 + %hi = load i64, ptr %25, align 8 + %26 = load i64, ptr %len, align 8 + %sub = sub i64 %26, 1 call void @"test_generic$sa$int$p$fn$int$int$$int$$.sort"(ptr %lo, i64 %hi, i64 0, i64 %sub, ptr @sort_test.cmp_int_value) - %38 = load i64, ptr %.anon5, align 8 - %add = add i64 %38, 1 + %27 = load i64, ptr %.anon5, align 8 + %add = add i64 %27, 1 store i64 %add, ptr %.anon5, align 8 br label %loop.cond @@ -169,77 +151,59 @@ entry: %0 = getelementptr inbounds [5 x %"int[]"], ptr %literal, i64 0, i64 0 store %"int[]" zeroinitializer, ptr %0, align 8 %1 = getelementptr inbounds [5 x %"int[]"], ptr %literal, i64 0, i64 1 - %2 = getelementptr inbounds [2 x i32], ptr %literal1, i64 0, i64 0 - store i32 10, ptr %2, align 4 - %3 = getelementptr inbounds [2 x i32], ptr %literal1, i64 0, i64 1 - store i32 3, ptr %3, align 4 - %4 = insertvalue %"int[]" undef, ptr %literal1, 0 - %5 = insertvalue %"int[]" %4, i64 2, 1 - store %"int[]" %5, ptr %1, align 8 - %6 = getelementptr inbounds [5 x %"int[]"], ptr %literal, i64 0, i64 2 - %7 = getelementptr inbounds [3 x i32], ptr %literal2, i64 0, i64 0 - store i32 3, ptr %7, align 4 - %8 = getelementptr inbounds [3 x i32], ptr %literal2, i64 0, i64 1 - store i32 2, ptr %8, align 4 - %9 = getelementptr inbounds [3 x i32], ptr %literal2, i64 0, i64 2 - store i32 1, ptr %9, align 4 - %10 = insertvalue %"int[]" undef, ptr %literal2, 0 - %11 = insertvalue %"int[]" %10, i64 3, 1 - store %"int[]" %11, ptr %6, align 8 - %12 = getelementptr inbounds [5 x %"int[]"], ptr %literal, i64 0, i64 3 - %13 = getelementptr inbounds [3 x i32], ptr %literal3, i64 0, i64 0 - store i32 1, ptr %13, align 4 - %14 = getelementptr inbounds [3 x i32], ptr %literal3, i64 0, i64 1 - store i32 2, ptr %14, align 4 - %15 = getelementptr inbounds [3 x i32], ptr %literal3, i64 0, i64 2 - store i32 3, ptr %15, align 4 - %16 = insertvalue %"int[]" undef, ptr %literal3, 0 - %17 = insertvalue %"int[]" %16, i64 3, 1 - store %"int[]" %17, ptr %12, align 8 - %18 = getelementptr inbounds [5 x %"int[]"], ptr %literal, i64 0, i64 4 - %19 = getelementptr inbounds [3 x i32], ptr %literal4, i64 0, i64 0 - store i32 2, ptr %19, align 4 - %20 = getelementptr inbounds [3 x i32], ptr %literal4, i64 0, i64 1 - store i32 1, ptr %20, align 4 - %21 = getelementptr inbounds [3 x i32], ptr %literal4, i64 0, i64 2 - store i32 3, ptr %21, align 4 - %22 = insertvalue %"int[]" undef, ptr %literal4, 0 - %23 = insertvalue %"int[]" %22, i64 3, 1 - store %"int[]" %23, ptr %18, align 8 - %24 = insertvalue %"int[][]" undef, ptr %literal, 0 - %25 = insertvalue %"int[][]" %24, i64 5, 1 - store %"int[][]" %25, ptr %tcases, align 8 - %26 = getelementptr inbounds %"int[][]", ptr %tcases, i32 0, i32 1 - %27 = load i64, ptr %26, align 8 - store i64 %27, ptr %.anon, align 8 + call void @llvm.memcpy.p0.p0.i32(ptr align 4 %literal1, ptr align 4 @.__const.4, i32 8, i1 false) + %2 = insertvalue %"int[]" undef, ptr %literal1, 0 + %3 = insertvalue %"int[]" %2, i64 2, 1 + store %"int[]" %3, ptr %1, align 8 + %4 = getelementptr inbounds [5 x %"int[]"], ptr %literal, i64 0, i64 2 + call void @llvm.memcpy.p0.p0.i32(ptr align 4 %literal2, ptr align 4 @.__const.5, i32 12, i1 false) + %5 = insertvalue %"int[]" undef, ptr %literal2, 0 + %6 = insertvalue %"int[]" %5, i64 3, 1 + store %"int[]" %6, ptr %4, align 8 + %7 = getelementptr inbounds [5 x %"int[]"], ptr %literal, i64 0, i64 3 + call void @llvm.memcpy.p0.p0.i32(ptr align 4 %literal3, ptr align 4 @.__const.6, i32 12, i1 false) + %8 = insertvalue %"int[]" undef, ptr %literal3, 0 + %9 = insertvalue %"int[]" %8, i64 3, 1 + store %"int[]" %9, ptr %7, align 8 + %10 = getelementptr inbounds [5 x %"int[]"], ptr %literal, i64 0, i64 4 + call void @llvm.memcpy.p0.p0.i32(ptr align 4 %literal4, ptr align 4 @.__const.7, i32 12, i1 false) + %11 = insertvalue %"int[]" undef, ptr %literal4, 0 + %12 = insertvalue %"int[]" %11, i64 3, 1 + store %"int[]" %12, ptr %10, align 8 + %13 = insertvalue %"int[][]" undef, ptr %literal, 0 + %14 = insertvalue %"int[][]" %13, i64 5, 1 + store %"int[][]" %14, ptr %tcases, align 8 + %15 = getelementptr inbounds %"int[][]", ptr %tcases, i32 0, i32 1 + %16 = load i64, ptr %15, align 8 + store i64 %16, ptr %.anon, align 8 store i64 0, ptr %.anon5, align 8 br label %loop.cond loop.cond: ; preds = %loop.body, %entry - %28 = load i64, ptr %.anon5, align 8 - %29 = load i64, ptr %.anon, align 8 - %lt = icmp ult i64 %28, %29 + %17 = load i64, ptr %.anon5, align 8 + %18 = load i64, ptr %.anon, align 8 + %lt = icmp ult i64 %17, %18 br i1 %lt, label %loop.body, label %loop.exit loop.body: ; preds = %loop.cond - %30 = getelementptr inbounds %"int[][]", ptr %tcases, i32 0, i32 0 - %31 = load ptr, ptr %30, align 8 - %32 = load i64, ptr %.anon5, align 8 - %ptroffset = getelementptr inbounds %"int[]", ptr %31, i64 %32 + %19 = getelementptr inbounds %"int[][]", ptr %tcases, i32 0, i32 0 + %20 = load ptr, ptr %19, align 8 + %21 = load i64, ptr %.anon5, align 8 + %ptroffset = getelementptr inbounds %"int[]", ptr %20, i64 %21 call void @llvm.memcpy.p0.p0.i32(ptr align 8 %tc, ptr align 8 %ptroffset, i32 16, i1 false) call void @llvm.memcpy.p0.p0.i32(ptr align 8 %list, ptr align 8 %tc, i32 16, i1 false) - %33 = getelementptr inbounds %"int[]", ptr %list, i32 0, i32 1 - %34 = load i64, ptr %33, align 8 - store i64 %34, ptr %len, align 8 - %35 = getelementptr inbounds %"int[]", ptr %list, i32 0, i32 0 - %lo = load ptr, ptr %35, align 8 - %36 = getelementptr inbounds %"int[]", ptr %list, i32 0, i32 1 - %hi = load i64, ptr %36, align 8 - %37 = load i64, ptr %len, align 8 - %sub = sub i64 %37, 1 + %22 = getelementptr inbounds %"int[]", ptr %list, i32 0, i32 1 + %23 = load i64, ptr %22, align 8 + store i64 %23, ptr %len, align 8 + %24 = getelementptr inbounds %"int[]", ptr %list, i32 0, i32 0 + %lo = load ptr, ptr %24, align 8 + %25 = getelementptr inbounds %"int[]", ptr %list, i32 0, i32 1 + %hi = load i64, ptr %25, align 8 + %26 = load i64, ptr %len, align 8 + %sub = sub i64 %26, 1 call void @"test_generic$sa$int$p$fn$int$int$$int$$.sort"(ptr %lo, i64 %hi, i64 0, i64 %sub, ptr @sort_test.cmp_int_value2) - %38 = load i64, ptr %.anon5, align 8 - %add = add i64 %38, 1 + %27 = load i64, ptr %.anon5, align 8 + %add = add i64 %27, 1 store i64 %add, ptr %.anon5, align 8 br label %loop.cond diff --git a/test/test_suite/initializer_lists/general_tests.c3t b/test/test_suite/initializer_lists/general_tests.c3t index 8f815709e..b644bc030 100644 --- a/test/test_suite/initializer_lists/general_tests.c3t +++ b/test/test_suite/initializer_lists/general_tests.c3t @@ -61,22 +61,17 @@ entry: store i32 0, ptr %0, align 4 store i32 33, ptr %foo2, align 4 store ptr @.str, ptr %str, align 8 - %1 = getelementptr inbounds [3 x i32], ptr %literal, i64 0, i64 0 - store i32 1, ptr %1, align 4 - %2 = getelementptr inbounds [3 x i32], ptr %literal, i64 0, i64 1 - store i32 2, ptr %2, align 4 - %3 = getelementptr inbounds [3 x i32], ptr %literal, i64 0, i64 2 - store i32 3, ptr %3, align 4 - %4 = insertvalue %"int[]" undef, ptr %literal, 0 - %5 = insertvalue %"int[]" %4, i64 3, 1 - %6 = extractvalue %"int[]" %5, 1 - %not = icmp eq i64 %6, 0 - %7 = zext i1 %not to i8 - store i8 %7, ptr %x, align 1 - %8 = getelementptr inbounds %Bar, ptr %b, i32 0, i32 0 - store i32 0, ptr %8, align 4 - %9 = getelementptr inbounds %Bar, ptr %b, i32 0, i32 1 - store i32 0, ptr %9, align 4 + call void @llvm.memcpy.p0.p0.i32(ptr align 4 %literal, ptr align 4 @.__const.1, i32 12, i1 false) + %1 = insertvalue %"int[]" undef, ptr %literal, 0 + %2 = insertvalue %"int[]" %1, i64 3, 1 + %3 = extractvalue %"int[]" %2, 1 + %not = icmp eq i64 %3, 0 + %4 = zext i1 %not to i8 + store i8 %4, ptr %x, align 1 + %5 = getelementptr inbounds %Bar, ptr %b, i32 0, i32 0 + store i32 0, ptr %5, align 4 + %6 = getelementptr inbounds %Bar, ptr %b, i32 0, i32 1 + store i32 0, ptr %6, align 4 call void @llvm.memset.p0.i64(ptr align 8 %z, i8 0, i64 8, i1 false) store %"int[]" zeroinitializer, ptr %sub, align 8 store %"Bar[]" zeroinitializer, ptr %foo, align 8 diff --git a/test/test_suite/initializer_lists/statics.c3t b/test/test_suite/initializer_lists/statics.c3t index 97947e7d4..fff830c3a 100644 --- a/test/test_suite/initializer_lists/statics.c3t +++ b/test/test_suite/initializer_lists/statics.c3t @@ -37,7 +37,7 @@ fn int main() @"$ct.statics.Baz" = linkonce global %.introspect { i8 11, ptr null, i64 8, i64 0, i64 2, [0 x i64] zeroinitializer }, align 8 @"$ct.statics.Bar" = linkonce global %.introspect { i8 10, ptr null, i64 8, i64 0, i64 2, [0 x i64] zeroinitializer }, align 8 -@.taddr = private global [1 x %Bar] [%Bar { i32 1, i32 2 }], align 8 +@.__const = private unnamed_addr constant [1 x %Bar] [%Bar { i32 1, i32 2 }], align 4 @test.c = internal unnamed_addr global %"Bar[]" { ptr @.taddr, i64 1 }, align 8 @.str = private unnamed_addr constant [7 x i8] c"%d %d\0A\00", align 1 @@ -45,46 +45,32 @@ define void @statics.test() #0 { entry: %b = alloca %"Bar[]", align 8 %literal = alloca [1 x %Bar], align 4 - %0 = getelementptr inbounds [1 x %Bar], ptr %literal, i64 0, i64 0 - %1 = getelementptr inbounds %Bar, ptr %0, i32 0, i32 0 - store i32 1, ptr %1, align 4 - %2 = getelementptr inbounds %Bar, ptr %0, i32 0, i32 1 - store i32 2, ptr %2, align 4 - %3 = insertvalue %"Bar[]" undef, ptr %literal, 0 - %4 = insertvalue %"Bar[]" %3, i64 1, 1 - store %"Bar[]" %4, ptr %b, align 8 - %5 = getelementptr inbounds %"Bar[]", ptr %b, i32 0, i32 0 - %6 = load ptr, ptr %5, align 8 - %ptroffset = getelementptr inbounds %Bar, ptr %6, i64 0 - %7 = getelementptr inbounds %Bar, ptr %ptroffset, i32 0, i32 1 + call void @llvm.memcpy.p0.p0.i32(ptr align 4 %literal, ptr align 4 @.__const, i32 8, i1 false) + %0 = insertvalue %"Bar[]" undef, ptr %literal, 0 + %1 = insertvalue %"Bar[]" %0, i64 1, 1 + store %"Bar[]" %1, ptr %b, align 8 + %2 = getelementptr inbounds %"Bar[]", ptr %b, i32 0, i32 0 + %3 = load ptr, ptr %2, align 8 + %ptroffset = getelementptr inbounds %Bar, ptr %3, i64 0 + %4 = getelementptr inbounds %Bar, ptr %ptroffset, i32 0, i32 1 + %5 = load i32, ptr %4, align 4 + %6 = load ptr, ptr @test.c, align 8 + %ptroffset1 = getelementptr inbounds %Bar, ptr %6, i64 0 + %7 = getelementptr inbounds %Bar, ptr %ptroffset1, i32 0, i32 1 %8 = load i32, ptr %7, align 4 - %9 = load ptr, ptr @test.c, align 8 - %ptroffset1 = getelementptr inbounds %Bar, ptr %9, i64 0 - %10 = getelementptr inbounds %Bar, ptr %ptroffset1, i32 0, i32 1 - %11 = load i32, ptr %10, align 4 - %12 = call i32 (ptr, ...) @printf(ptr @.str, i32 %8, i32 %11) - %13 = getelementptr inbounds %"Bar[]", ptr %b, i32 0, i32 0 - %14 = load ptr, ptr %13, align 8 - %ptroffset2 = getelementptr inbounds %Bar, ptr %14, i64 0 - %15 = getelementptr inbounds %Bar, ptr %ptroffset2, i32 0, i32 1 + %9 = call i32 (ptr, ...) @printf(ptr @.str, i32 %5, i32 %8) + %10 = getelementptr inbounds %"Bar[]", ptr %b, i32 0, i32 0 + %11 = load ptr, ptr %10, align 8 + %ptroffset2 = getelementptr inbounds %Bar, ptr %11, i64 0 + %12 = getelementptr inbounds %Bar, ptr %ptroffset2, i32 0, i32 1 + %13 = load i32, ptr %12, align 4 + %add = add i32 %13, 1 + store i32 %add, ptr %12, align 4 + %14 = load ptr, ptr @test.c, align 8 + %ptroffset3 = getelementptr inbounds %Bar, ptr %14, i64 0 + %15 = getelementptr inbounds %Bar, ptr %ptroffset3, i32 0, i32 1 %16 = load i32, ptr %15, align 4 - %add = add i32 %16, 1 - store i32 %add, ptr %15, align 4 - %17 = load ptr, ptr @test.c, align 8 - %ptroffset3 = getelementptr inbounds %Bar, ptr %17, i64 0 - %18 = getelementptr inbounds %Bar, ptr %ptroffset3, i32 0, i32 1 - %19 = load i32, ptr %18, align 4 - %add4 = add i32 %19, 1 - store i32 %add4, ptr %18, align 4 + %add4 = add i32 %16, 1 + store i32 %add4, ptr %15, align 4 ret void } - -define i32 @main() #0 { -entry: - call void @statics.test() - call void @statics.test() - call void @statics.test() - ret i32 1 -} - -declare i32 @printf(ptr, ...) \ No newline at end of file diff --git a/test/test_suite/initializer_lists/subarrays.c3t b/test/test_suite/initializer_lists/subarrays.c3t index eeb466843..eca81d4c3 100644 --- a/test/test_suite/initializer_lists/subarrays.c3t +++ b/test/test_suite/initializer_lists/subarrays.c3t @@ -60,12 +60,12 @@ fn int main() @.taddr.4 = private global [2 x i32] [i32 3, i32 4], align 4 @subarrays.fofeo = local_unnamed_addr global ptr @.taddr.4, align 8 @.str = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1 -@.str.5 = private unnamed_addr constant [7 x i8] c"Start:\00", align 1 -@.str.6 = private unnamed_addr constant [26 x i8] c"X len: %d mid element %d\0A\00", align 1 -@.str.7 = private unnamed_addr constant [18 x i8] c"Y mid element %d\0A\00", align 1 -@.str.8 = private unnamed_addr constant [25 x i8] c"Fofeo second element %d\0A\00", align 1 -@.__const = private unnamed_addr constant { i32, [4 x i8] } { i32 1, [4 x i8] undef }, align 8 -@.str.9 = private unnamed_addr constant [3 x i8] c"Ok\00", align 1 +@.str.6 = private unnamed_addr constant [7 x i8] c"Start:\00", align 1 +@.str.7 = private unnamed_addr constant [26 x i8] c"X len: %d mid element %d\0A\00", align 1 +@.str.8 = private unnamed_addr constant [18 x i8] c"Y mid element %d\0A\00", align 1 +@.str.9 = private unnamed_addr constant [25 x i8] c"Fofeo second element %d\0A\00", align 1 +@.__const.10 = private unnamed_addr constant { i32, [4 x i8] } { i32 1, [4 x i8] undef }, align 8 +@.str.12 = private unnamed_addr constant [3 x i8] c"Ok\00", align 1 ; Function Attrs: nounwind define i32 @main() #0 { @@ -96,74 +96,59 @@ entry: %2 = getelementptr inbounds %Bar, ptr %ptroffset1, i32 0, i32 0 %3 = load i32, ptr %2, align 4 %4 = call i32 (ptr, ...) @printf(ptr @.str, i32 %3) - %5 = getelementptr inbounds [3 x i32], ptr %literal, i64 0, i64 0 - store i32 1, ptr %5, align 4 - %6 = getelementptr inbounds [3 x i32], ptr %literal, i64 0, i64 1 - store i32 2, ptr %6, align 4 - %7 = getelementptr inbounds [3 x i32], ptr %literal, i64 0, i64 2 - store i32 3, ptr %7, align 4 - %8 = insertvalue %"int[]" undef, ptr %literal, 0 - %9 = insertvalue %"int[]" %8, i64 3, 1 - store %"int[]" %9, ptr %x, align 8 - %10 = getelementptr inbounds [3 x i32], ptr %literal2, i64 0, i64 0 - store i32 123, ptr %10, align 4 - %11 = getelementptr inbounds [3 x i32], ptr %literal2, i64 0, i64 1 - store i32 234, ptr %11, align 4 - %12 = getelementptr inbounds [3 x i32], ptr %literal2, i64 0, i64 2 - store i32 567, ptr %12, align 4 + call void @llvm.memcpy.p0.p0.i32(ptr align 4 %literal, ptr align 4 @.__const, i32 12, i1 false) + %5 = insertvalue %"int[]" undef, ptr %literal, 0 + %6 = insertvalue %"int[]" %5, i64 3, 1 + store %"int[]" %6, ptr %x, align 8 + call void @llvm.memcpy.p0.p0.i32(ptr align 4 %literal2, ptr align 4 @.__const.5, i32 12, i1 false) store ptr %literal2, ptr %y, align 8 - %13 = call ptr @std.io.stdout() - store ptr %13, ptr %result, align 8 - %14 = load ptr, ptr %result, align 8 - %15 = call i64 @std.io.File.printn(ptr %retparam, ptr %14, ptr @.str.5, i64 6) - %16 = getelementptr inbounds %"int[]", ptr %x, i32 0, i32 1 - %17 = load i64, ptr %16, align 8 - %trunc = trunc i64 %17 to i32 - %18 = getelementptr inbounds %"int[]", ptr %x, i32 0, i32 0 - %19 = load ptr, ptr %18, align 8 - %ptroffset3 = getelementptr inbounds i32, ptr %19, i64 1 - %20 = load i32, ptr %ptroffset3, align 4 - %21 = call i32 (ptr, ...) @printf(ptr @.str.6, i32 %trunc, i32 %20) - %22 = load ptr, ptr %y, align 8 - %ptroffset4 = getelementptr inbounds i32, ptr %22, i64 1 - %23 = load i32, ptr %ptroffset4, align 4 - %24 = call i32 (ptr, ...) @printf(ptr @.str.7, i32 %23) - %25 = load ptr, ptr @subarrays.fofeo, align 8 - %ptroffset5 = getelementptr inbounds i32, ptr %25, i64 1 - %26 = load i32, ptr %ptroffset5, align 4 - %27 = call i32 (ptr, ...) @printf(ptr @.str.8, i32 %26) - call void @llvm.memcpy.p0.p0.i32(ptr align 8 %ffe, ptr align 8 @.__const, i32 8, i1 false) - %28 = getelementptr inbounds [1 x i32], ptr %azz, i64 0, i64 0 - store i32 0, ptr %28, align 4 - %29 = getelementptr inbounds [3 x i32], ptr %literal6, i64 0, i64 0 - store i32 1, ptr %29, align 4 - %30 = getelementptr inbounds [3 x i32], ptr %literal6, i64 0, i64 1 - store i32 2, ptr %30, align 4 - %31 = getelementptr inbounds [3 x i32], ptr %literal6, i64 0, i64 2 - store i32 3, ptr %31, align 4 - %32 = insertvalue %"int[]" undef, ptr %literal6, 0 - %33 = insertvalue %"int[]" %32, i64 3, 1 - %34 = extractvalue %"int[]" %33, 1 - %not = icmp eq i64 %34, 0 - %35 = zext i1 %not to i8 - store i8 %35, ptr %xy, align 1 - %36 = load i8, ptr %xy, align 1 - %37 = trunc i8 %36 to i1 - %not7 = xor i1 %37, true + %7 = call ptr @std.io.stdout() + store ptr %7, ptr %result, align 8 + %8 = load ptr, ptr %result, align 8 + %9 = call i64 @std.io.File.printn(ptr %retparam, ptr %8, ptr @.str.6, i64 6) + %10 = getelementptr inbounds %"int[]", ptr %x, i32 0, i32 1 + %11 = load i64, ptr %10, align 8 + %trunc = trunc i64 %11 to i32 + %12 = getelementptr inbounds %"int[]", ptr %x, i32 0, i32 0 + %13 = load ptr, ptr %12, align 8 + %ptroffset3 = getelementptr inbounds i32, ptr %13, i64 1 + %14 = load i32, ptr %ptroffset3, align 4 + %15 = call i32 (ptr, ...) @printf(ptr @.str.7, i32 %trunc, i32 %14) + %16 = load ptr, ptr %y, align 8 + %ptroffset4 = getelementptr inbounds i32, ptr %16, i64 1 + %17 = load i32, ptr %ptroffset4, align 4 + %18 = call i32 (ptr, ...) @printf(ptr @.str.8, i32 %17) + %19 = load ptr, ptr @subarrays.fofeo, align 8 + %ptroffset5 = getelementptr inbounds i32, ptr %19, i64 1 + %20 = load i32, ptr %ptroffset5, align 4 + %21 = call i32 (ptr, ...) @printf(ptr @.str.9, i32 %20) + call void @llvm.memcpy.p0.p0.i32(ptr align 8 %ffe, ptr align 8 @.__const.10, i32 8, i1 false) + %22 = getelementptr inbounds [1 x i32], ptr %azz, i64 0, i64 0 + store i32 0, ptr %22, align 4 + call void @llvm.memcpy.p0.p0.i32(ptr align 4 %literal6, ptr align 4 @.__const.11, i32 12, i1 false) + %23 = insertvalue %"int[]" undef, ptr %literal6, 0 + %24 = insertvalue %"int[]" %23, i64 3, 1 + %25 = extractvalue %"int[]" %24, 1 + %not = icmp eq i64 %25, 0 + %26 = zext i1 %not to i8 + store i8 %26, ptr %xy, align 1 + %27 = load i8, ptr %xy, align 1 + %28 = trunc i8 %27 to i1 + %not7 = xor i1 %28, true br i1 %not7, label %if.then, label %if.exit if.then: ; preds = %entry - %38 = call ptr @std.io.stdout() - store ptr %38, ptr %result9, align 8 - %39 = load ptr, ptr %result9, align 8 - %40 = call i64 @std.io.File.printn(ptr %retparam8, ptr %39, ptr @.str.9, i64 2) + %29 = call ptr @std.io.stdout() + store ptr %29, ptr %result9, align 8 + %30 = load ptr, ptr %result9, align 8 + %31 = call i64 @std.io.File.printn(ptr %retparam8, ptr %30, ptr @.str.12, i64 2) br label %if.exit if.exit: ; preds = %if.then, %entry - %41 = getelementptr inbounds %Bar, ptr %b, i32 0, i32 0 - store i32 0, ptr %41, align 4 - %42 = getelementptr inbounds %Bar, ptr %b, i32 0, i32 1 - store i32 0, ptr %42, align 4 + %32 = getelementptr inbounds %Bar, ptr %b, i32 0, i32 0 + store i32 0, ptr %32, align 4 + %33 = getelementptr inbounds %Bar, ptr %b, i32 0, i32 1 + store i32 0, ptr %33, align 4 call void @llvm.memset.p0.i64(ptr align 8 %z, i8 0, i64 8, i1 false) store %"int[]" zeroinitializer, ptr %sub, align 8 store %"Bar[]" zeroinitializer, ptr %foo, align 8 diff --git a/test/test_suite/macros/macro_typed_varargs.c3t b/test/test_suite/macros/macro_typed_varargs.c3t index 274537fce..75e7de1c0 100644 --- a/test/test_suite/macros/macro_typed_varargs.c3t +++ b/test/test_suite/macros/macro_typed_varargs.c3t @@ -48,94 +48,93 @@ entry: %i12 = alloca %any, align 8 %retparam14 = alloca i64, align 8 %varargslots15 = alloca [1 x %any], align 16 - %0 = getelementptr inbounds [4 x i32], ptr %literal, i64 0, i64 0 - store i32 1, ptr %0, align 4 - %1 = getelementptr inbounds [4 x i32], ptr %literal, i64 0, i64 1 - store i32 -1, ptr %1, align 4 - %2 = getelementptr inbounds [4 x i32], ptr %literal, i64 0, i64 2 - store i32 3141, ptr %2, align 4 - %3 = getelementptr inbounds [4 x i32], ptr %literal, i64 0, i64 3 - store i32 1000, ptr %3, align 4 - %4 = insertvalue %"int[]" undef, ptr %literal, 0 - %5 = insertvalue %"int[]" %4, i64 4, 1 - store %"int[]" %5, ptr %x, align 8 - %6 = getelementptr inbounds %"int[]", ptr %x, i32 0, i32 1 - %7 = load i64, ptr %6, align 8 - store i64 %7, ptr %.anon, align 8 + call void @llvm.memcpy.p0.p0.i32(ptr align 4 %literal, ptr align 16 @.__const, i32 16, i1 false) + %0 = insertvalue %"int[]" undef, ptr %literal, 0 + %1 = insertvalue %"int[]" %0, i64 4, 1 + store %"int[]" %1, ptr %x, align 8 + %2 = getelementptr inbounds %"int[]", ptr %x, i32 0, i32 1 + %3 = load i64, ptr %2, align 8 + store i64 %3, ptr %.anon, align 8 store i64 0, ptr %.anon1, align 8 br label %loop.cond + loop.cond: ; preds = %loop.body, %entry - %8 = load i64, ptr %.anon1, align 8 - %9 = load i64, ptr %.anon, align 8 - %lt = icmp ult i64 %8, %9 + %4 = load i64, ptr %.anon1, align 8 + %5 = load i64, ptr %.anon, align 8 + %lt = icmp ult i64 %4, %5 br i1 %lt, label %loop.body, label %loop.exit + loop.body: ; preds = %loop.cond - %10 = getelementptr inbounds %"int[]", ptr %x, i32 0, i32 0 - %11 = load ptr, ptr %10, align 8 - %12 = load i64, ptr %.anon1, align 8 - %ptroffset = getelementptr inbounds i32, ptr %11, i64 %12 - %13 = load i32, ptr %ptroffset, align 4 - store i32 %13, ptr %i, align 4 - %14 = insertvalue %any undef, ptr %i, 0 - %15 = insertvalue %any %14, i64 ptrtoint (ptr @"$ct.int" to i64), 1 - %16 = getelementptr inbounds [1 x %any], ptr %varargslots, i64 0, i64 0 - store %any %15, ptr %16, align 16 - %17 = call i64 @std.io.printfn(ptr %retparam, ptr @.str, i64 2, ptr %varargslots, i64 1) - %18 = load i64, ptr %.anon1, align 8 - %add = add i64 %18, 1 + %6 = getelementptr inbounds %"int[]", ptr %x, i32 0, i32 0 + %7 = load ptr, ptr %6, align 8 + %8 = load i64, ptr %.anon1, align 8 + %ptroffset = getelementptr inbounds i32, ptr %7, i64 %8 + %9 = load i32, ptr %ptroffset, align 4 + store i32 %9, ptr %i, align 4 + %10 = insertvalue %any undef, ptr %i, 0 + %11 = insertvalue %any %10, i64 ptrtoint (ptr @"$ct.int" to i64), 1 + %12 = getelementptr inbounds [1 x %any], ptr %varargslots, i64 0, i64 0 + store %any %11, ptr %12, align 16 + %13 = call i64 @std.io.printfn(ptr %retparam, ptr @.str, i64 2, ptr %varargslots, i64 1) + %14 = load i64, ptr %.anon1, align 8 + %add = add i64 %14, 1 store i64 %add, ptr %.anon1, align 8 br label %loop.cond + loop.exit: ; preds = %loop.cond - %19 = getelementptr inbounds [4 x %any], ptr %literal2, i64 0, i64 0 + %15 = getelementptr inbounds [4 x %any], ptr %literal2, i64 0, i64 0 store i32 1, ptr %taddr, align 4 - %20 = insertvalue %any undef, ptr %taddr, 0 - %21 = insertvalue %any %20, i64 ptrtoint (ptr @"$ct.int" to i64), 1 - store %any %21, ptr %19, align 8 - %22 = getelementptr inbounds [4 x %any], ptr %literal2, i64 0, i64 1 + %16 = insertvalue %any undef, ptr %taddr, 0 + %17 = insertvalue %any %16, i64 ptrtoint (ptr @"$ct.int" to i64), 1 + store %any %17, ptr %15, align 8 + %18 = getelementptr inbounds [4 x %any], ptr %literal2, i64 0, i64 1 store i32 -1, ptr %taddr3, align 4 - %23 = insertvalue %any undef, ptr %taddr3, 0 - %24 = insertvalue %any %23, i64 ptrtoint (ptr @"$ct.int" to i64), 1 - store %any %24, ptr %22, align 8 - %25 = getelementptr inbounds [4 x %any], ptr %literal2, i64 0, i64 2 + %19 = insertvalue %any undef, ptr %taddr3, 0 + %20 = insertvalue %any %19, i64 ptrtoint (ptr @"$ct.int" to i64), 1 + store %any %20, ptr %18, align 8 + %21 = getelementptr inbounds [4 x %any], ptr %literal2, i64 0, i64 2 store i32 3141, ptr %taddr4, align 4 - %26 = insertvalue %any undef, ptr %taddr4, 0 - %27 = insertvalue %any %26, i64 ptrtoint (ptr @"$ct.int" to i64), 1 - store %any %27, ptr %25, align 8 - %28 = getelementptr inbounds [4 x %any], ptr %literal2, i64 0, i64 3 + %22 = insertvalue %any undef, ptr %taddr4, 0 + %23 = insertvalue %any %22, i64 ptrtoint (ptr @"$ct.int" to i64), 1 + store %any %23, ptr %21, align 8 + %24 = getelementptr inbounds [4 x %any], ptr %literal2, i64 0, i64 3 store i32 1000, ptr %taddr5, align 4 - %29 = insertvalue %any undef, ptr %taddr5, 0 - %30 = insertvalue %any %29, i64 ptrtoint (ptr @"$ct.int" to i64), 1 - store %any %30, ptr %28, align 8 - %31 = insertvalue %"any[]" undef, ptr %literal2, 0 - %32 = insertvalue %"any[]" %31, i64 4, 1 - store %"any[]" %32, ptr %x6, align 8 - %33 = getelementptr inbounds %"any[]", ptr %x6, i32 0, i32 1 - %34 = load i64, ptr %33, align 8 - store i64 %34, ptr %.anon7, align 8 + %25 = insertvalue %any undef, ptr %taddr5, 0 + %26 = insertvalue %any %25, i64 ptrtoint (ptr @"$ct.int" to i64), 1 + store %any %26, ptr %24, align 8 + %27 = insertvalue %"any[]" undef, ptr %literal2, 0 + %28 = insertvalue %"any[]" %27, i64 4, 1 + store %"any[]" %28, ptr %x6, align 8 + %29 = getelementptr inbounds %"any[]", ptr %x6, i32 0, i32 1 + %30 = load i64, ptr %29, align 8 + store i64 %30, ptr %.anon7, align 8 store i64 0, ptr %.anon8, align 8 br label %loop.cond9 + loop.cond9: ; preds = %loop.body11, %loop.exit - %35 = load i64, ptr %.anon8, align 8 - %36 = load i64, ptr %.anon7, align 8 - %lt10 = icmp ult i64 %35, %36 + %31 = load i64, ptr %.anon8, align 8 + %32 = load i64, ptr %.anon7, align 8 + %lt10 = icmp ult i64 %31, %32 br i1 %lt10, label %loop.body11, label %loop.exit17 + loop.body11: ; preds = %loop.cond9 - %37 = getelementptr inbounds %"any[]", ptr %x6, i32 0, i32 0 - %38 = load ptr, ptr %37, align 8 - %39 = load i64, ptr %.anon8, align 8 - %ptroffset13 = getelementptr inbounds %any, ptr %38, i64 %39 + %33 = getelementptr inbounds %"any[]", ptr %x6, i32 0, i32 0 + %34 = load ptr, ptr %33, align 8 + %35 = load i64, ptr %.anon8, align 8 + %ptroffset13 = getelementptr inbounds %any, ptr %34, i64 %35 call void @llvm.memcpy.p0.p0.i32(ptr align 8 %i12, ptr align 8 %ptroffset13, i32 16, i1 false) - %40 = getelementptr inbounds %any, ptr %i12, i32 0, i32 0 - %41 = load ptr, ptr %40, align 8 - %42 = insertvalue %any undef, ptr %41, 0 - %43 = insertvalue %any %42, i64 ptrtoint (ptr @"$ct.int" to i64), 1 - %44 = getelementptr inbounds [1 x %any], ptr %varargslots15, i64 0, i64 0 - store %any %43, ptr %44, align 16 - %45 = call i64 @std.io.printfn(ptr %retparam14, ptr @.str.1, i64 2, ptr %varargslots15, i64 1) - %46 = load i64, ptr %.anon8, align 8 - %add16 = add i64 %46, 1 + %36 = getelementptr inbounds %any, ptr %i12, i32 0, i32 0 + %37 = load ptr, ptr %36, align 8 + %38 = insertvalue %any undef, ptr %37, 0 + %39 = insertvalue %any %38, i64 ptrtoint (ptr @"$ct.int" to i64), 1 + %40 = getelementptr inbounds [1 x %any], ptr %varargslots15, i64 0, i64 0 + store %any %39, ptr %40, align 16 + %41 = call i64 @std.io.printfn(ptr %retparam14, ptr @.str.1, i64 2, ptr %varargslots15, i64 1) + %42 = load i64, ptr %.anon8, align 8 + %add16 = add i64 %42, 1 store i64 %add16, ptr %.anon8, align 8 br label %loop.cond9 + loop.exit17: ; preds = %loop.cond9 ret void } diff --git a/test/test_suite/slices/slice_to_slice_assign.c3t b/test/test_suite/slices/slice_to_slice_assign.c3t index e6a4fc046..7dd99974b 100644 --- a/test/test_suite/slices/slice_to_slice_assign.c3t +++ b/test/test_suite/slices/slice_to_slice_assign.c3t @@ -90,61 +90,59 @@ entry: store %any %33, ptr %34, align 16 %35 = call i64 @std.io.printfn(ptr %retparam2, ptr @.str.1, i64 5, ptr %varargslots3, i64 2) %36 = getelementptr inbounds [1 x %"int[]"], ptr %literal, i64 0, i64 0 - %37 = getelementptr inbounds [1 x i32], ptr %literal4, i64 0, i64 0 - store i32 1, ptr %37, align 4 - %38 = insertvalue %"int[]" undef, ptr %literal4, 0 - %39 = insertvalue %"int[]" %38, i64 1, 1 - store %"int[]" %39, ptr %36, align 8 - %40 = insertvalue %"int[][]" undef, ptr %literal, 0 - %41 = insertvalue %"int[][]" %40, i64 1, 1 - store %"int[][]" %41, ptr %a, align 8 - %42 = getelementptr inbounds [1 x %"int[]"], ptr %literal5, i64 0, i64 0 - %43 = getelementptr inbounds [1 x i32], ptr %literal6, i64 0, i64 0 - store i32 2, ptr %43, align 4 - %44 = insertvalue %"int[]" undef, ptr %literal6, 0 - %45 = insertvalue %"int[]" %44, i64 1, 1 - store %"int[]" %45, ptr %42, align 8 - %46 = insertvalue %"int[][]" undef, ptr %literal5, 0 - %47 = insertvalue %"int[][]" %46, i64 1, 1 - store %"int[][]" %47, ptr %b, align 8 - %48 = insertvalue %any undef, ptr %a, 0 - %49 = insertvalue %any %48, i64 ptrtoint (ptr @"$ct.sa$sa$int" to i64), 1 - %50 = getelementptr inbounds [1 x %any], ptr %varargslots8, i64 0, i64 0 - store %any %49, ptr %50, align 16 - %51 = call i64 @std.io.printfn(ptr %retparam7, ptr @.str.2, i64 2, ptr %varargslots8, i64 1) - %52 = load %"int[][]", ptr %b, align 8 - %53 = extractvalue %"int[][]" %52, 0 - %ptroffset = getelementptr inbounds %"int[]", ptr %53, i64 0 - %54 = insertvalue %"int[][]" undef, ptr %ptroffset, 0 - %55 = insertvalue %"int[][]" %54, i64 1, 1 - %56 = load %"int[][]", ptr %a, align 8 - %57 = extractvalue %"int[][]" %56, 0 - %ptroffset9 = getelementptr inbounds %"int[]", ptr %57, i64 0 - %58 = insertvalue %"int[][]" undef, ptr %ptroffset9, 0 - %59 = insertvalue %"int[][]" %58, i64 1, 1 - %60 = extractvalue %"int[][]" %59, 0 - %61 = extractvalue %"int[][]" %55, 0 - store %"int[][]" %55, ptr %taddr10, align 8 - %62 = getelementptr inbounds %"int[][]", ptr %taddr10, i32 0, i32 1 - %63 = load i64, ptr %62, align 8 - %64 = mul i64 %63, 16 - call void @llvm.memcpy.p0.p0.i64(ptr align 8 %60, ptr align 8 %61, i64 %64, i1 false) - %65 = insertvalue %any undef, ptr %a, 0 - %66 = insertvalue %any %65, i64 ptrtoint (ptr @"$ct.sa$sa$int" to i64), 1 - %67 = getelementptr inbounds [1 x %any], ptr %varargslots12, i64 0, i64 0 - store %any %66, ptr %67, align 16 - %68 = call i64 @std.io.printfn(ptr %retparam11, ptr @.str.3, i64 2, ptr %varargslots12, i64 1) - %69 = getelementptr inbounds [6 x i32], ptr %y, i64 0, i64 2 - %70 = insertvalue %"int[]" undef, ptr %69, 0 - %71 = insertvalue %"int[]" %70, i64 3, 1 - %72 = load %"int[][]", ptr %a, align 8 - %73 = extractvalue %"int[][]" %72, 0 - %ptroffset13 = getelementptr inbounds %"int[]", ptr %73, i64 0 - store %"int[]" %71, ptr %ptroffset13, align 8 - %74 = insertvalue %any undef, ptr %a, 0 - %75 = insertvalue %any %74, i64 ptrtoint (ptr @"$ct.sa$sa$int" to i64), 1 - %76 = getelementptr inbounds [1 x %any], ptr %varargslots15, i64 0, i64 0 - store %any %75, ptr %76, align 16 - %77 = call i64 @std.io.printfn(ptr %retparam14, ptr @.str.4, i64 2, ptr %varargslots15, i64 1) + call void @llvm.memcpy.p0.p0.i32(ptr align 4 %literal4, ptr align 4 @.__const.2, i32 4, i1 false) + %37 = insertvalue %"int[]" undef, ptr %literal4, 0 + %38 = insertvalue %"int[]" %37, i64 1, 1 + store %"int[]" %38, ptr %36, align 8 + %39 = insertvalue %"int[][]" undef, ptr %literal, 0 + %40 = insertvalue %"int[][]" %39, i64 1, 1 + store %"int[][]" %40, ptr %a, align 8 + %41 = getelementptr inbounds [1 x %"int[]"], ptr %literal5, i64 0, i64 0 + call void @llvm.memcpy.p0.p0.i32(ptr align 4 %literal6, ptr align 4 @.__const.3, i32 4, i1 false) + %42 = insertvalue %"int[]" undef, ptr %literal6, 0 + %43 = insertvalue %"int[]" %42, i64 1, 1 + store %"int[]" %43, ptr %41, align 8 + %44 = insertvalue %"int[][]" undef, ptr %literal5, 0 + %45 = insertvalue %"int[][]" %44, i64 1, 1 + store %"int[][]" %45, ptr %b, align 8 + %46 = insertvalue %any undef, ptr %a, 0 + %47 = insertvalue %any %46, i64 ptrtoint (ptr @"$ct.sa$sa$int" to i64), 1 + %48 = getelementptr inbounds [1 x %any], ptr %varargslots8, i64 0, i64 0 + store %any %47, ptr %48, align 16 + %49 = call i64 @std.io.printfn(ptr %retparam7, ptr @.str.4, i64 2, ptr %varargslots8, i64 1) + %50 = load %"int[][]", ptr %b, align 8 + %51 = extractvalue %"int[][]" %50, 0 + %ptroffset = getelementptr inbounds %"int[]", ptr %51, i64 0 + %52 = insertvalue %"int[][]" undef, ptr %ptroffset, 0 + %53 = insertvalue %"int[][]" %52, i64 1, 1 + %54 = load %"int[][]", ptr %a, align 8 + %55 = extractvalue %"int[][]" %54, 0 + %ptroffset9 = getelementptr inbounds %"int[]", ptr %55, i64 0 + %56 = insertvalue %"int[][]" undef, ptr %ptroffset9, 0 + %57 = insertvalue %"int[][]" %56, i64 1, 1 + %58 = extractvalue %"int[][]" %57, 0 + %59 = extractvalue %"int[][]" %53, 0 + store %"int[][]" %53, ptr %taddr10, align 8 + %60 = getelementptr inbounds %"int[][]", ptr %taddr10, i32 0, i32 1 + %61 = load i64, ptr %60, align 8 + %62 = mul i64 %61, 16 + call void @llvm.memcpy.p0.p0.i64(ptr align 8 %58, ptr align 8 %59, i64 %62, i1 false) + %63 = insertvalue %any undef, ptr %a, 0 + %64 = insertvalue %any %63, i64 ptrtoint (ptr @"$ct.sa$sa$int" to i64), 1 + %65 = getelementptr inbounds [1 x %any], ptr %varargslots12, i64 0, i64 0 + store %any %64, ptr %65, align 16 + %66 = call i64 @std.io.printfn(ptr %retparam11, ptr @.str.5, i64 2, ptr %varargslots12, i64 1) + %67 = getelementptr inbounds [6 x i32], ptr %y, i64 0, i64 2 + %68 = insertvalue %"int[]" undef, ptr %67, 0 + %69 = insertvalue %"int[]" %68, i64 3, 1 + %70 = load %"int[][]", ptr %a, align 8 + %71 = extractvalue %"int[][]" %70, 0 + %ptroffset13 = getelementptr inbounds %"int[]", ptr %71, i64 0 + store %"int[]" %69, ptr %ptroffset13, align 8 + %72 = insertvalue %any undef, ptr %a, 0 + %73 = insertvalue %any %72, i64 ptrtoint (ptr @"$ct.sa$sa$int" to i64), 1 + %74 = getelementptr inbounds [1 x %any], ptr %varargslots15, i64 0, i64 0 + store %any %73, ptr %74, align 16 + %75 = call i64 @std.io.printfn(ptr %retparam14, ptr @.str.6, i64 2, ptr %varargslots15, i64 1) ret void } diff --git a/test/test_suite/slices/slice_to_slice_vector_assign.c3t b/test/test_suite/slices/slice_to_slice_vector_assign.c3t index ed3fc6aa8..20542111a 100644 --- a/test/test_suite/slices/slice_to_slice_vector_assign.c3t +++ b/test/test_suite/slices/slice_to_slice_vector_assign.c3t @@ -91,61 +91,59 @@ entry: store %any %33, ptr %34, align 16 %35 = call i64 @std.io.printfn(ptr %retparam2, ptr @.str.1, i64 5, ptr %varargslots3, i64 2) %36 = getelementptr inbounds [1 x %"int[]"], ptr %literal, i64 0, i64 0 - %37 = getelementptr inbounds [1 x i32], ptr %literal4, i64 0, i64 0 - store i32 1, ptr %37, align 4 - %38 = insertvalue %"int[]" undef, ptr %literal4, 0 - %39 = insertvalue %"int[]" %38, i64 1, 1 - store %"int[]" %39, ptr %36, align 8 - %40 = insertvalue %"int[][]" undef, ptr %literal, 0 - %41 = insertvalue %"int[][]" %40, i64 1, 1 - store %"int[][]" %41, ptr %a, align 8 - %42 = getelementptr inbounds [1 x %"int[]"], ptr %literal5, i64 0, i64 0 - %43 = getelementptr inbounds [1 x i32], ptr %literal6, i64 0, i64 0 - store i32 2, ptr %43, align 4 - %44 = insertvalue %"int[]" undef, ptr %literal6, 0 - %45 = insertvalue %"int[]" %44, i64 1, 1 - store %"int[]" %45, ptr %42, align 8 - %46 = insertvalue %"int[][]" undef, ptr %literal5, 0 - %47 = insertvalue %"int[][]" %46, i64 1, 1 - store %"int[][]" %47, ptr %b, align 8 - %48 = insertvalue %any undef, ptr %a, 0 - %49 = insertvalue %any %48, i64 ptrtoint (ptr @"$ct.sa$sa$int" to i64), 1 - %50 = getelementptr inbounds [1 x %any], ptr %varargslots8, i64 0, i64 0 - store %any %49, ptr %50, align 16 - %51 = call i64 @std.io.printfn(ptr %retparam7, ptr @.str.2, i64 2, ptr %varargslots8, i64 1) - %52 = load %"int[][]", ptr %b, align 8 - %53 = extractvalue %"int[][]" %52, 0 - %ptroffset = getelementptr inbounds %"int[]", ptr %53, i64 0 - %54 = insertvalue %"int[][]" undef, ptr %ptroffset, 0 - %55 = insertvalue %"int[][]" %54, i64 1, 1 - %56 = load %"int[][]", ptr %a, align 8 - %57 = extractvalue %"int[][]" %56, 0 - %ptroffset9 = getelementptr inbounds %"int[]", ptr %57, i64 0 - %58 = insertvalue %"int[][]" undef, ptr %ptroffset9, 0 - %59 = insertvalue %"int[][]" %58, i64 1, 1 - %60 = extractvalue %"int[][]" %59, 0 - %61 = extractvalue %"int[][]" %55, 0 - store %"int[][]" %55, ptr %taddr10, align 8 - %62 = getelementptr inbounds %"int[][]", ptr %taddr10, i32 0, i32 1 - %63 = load i64, ptr %62, align 8 - %64 = mul i64 %63, 16 - call void @llvm.memcpy.p0.p0.i64(ptr align 8 %60, ptr align 8 %61, i64 %64, i1 false) - %65 = insertvalue %any undef, ptr %a, 0 - %66 = insertvalue %any %65, i64 ptrtoint (ptr @"$ct.sa$sa$int" to i64), 1 - %67 = getelementptr inbounds [1 x %any], ptr %varargslots12, i64 0, i64 0 - store %any %66, ptr %67, align 16 - %68 = call i64 @std.io.printfn(ptr %retparam11, ptr @.str.3, i64 2, ptr %varargslots12, i64 1) - %69 = getelementptr inbounds <6 x i32>, ptr %y, i64 0, i64 2 - %70 = insertvalue %"int[]" undef, ptr %69, 0 - %71 = insertvalue %"int[]" %70, i64 3, 1 - %72 = load %"int[][]", ptr %a, align 8 - %73 = extractvalue %"int[][]" %72, 0 - %ptroffset13 = getelementptr inbounds %"int[]", ptr %73, i64 0 - store %"int[]" %71, ptr %ptroffset13, align 8 - %74 = insertvalue %any undef, ptr %a, 0 - %75 = insertvalue %any %74, i64 ptrtoint (ptr @"$ct.sa$sa$int" to i64), 1 - %76 = getelementptr inbounds [1 x %any], ptr %varargslots15, i64 0, i64 0 - store %any %75, ptr %76, align 16 - %77 = call i64 @std.io.printfn(ptr %retparam14, ptr @.str.4, i64 2, ptr %varargslots15, i64 1) + call void @llvm.memcpy.p0.p0.i32(ptr align 4 %literal4, ptr align 4 @.__const, i32 4, i1 false) + %37 = insertvalue %"int[]" undef, ptr %literal4, 0 + %38 = insertvalue %"int[]" %37, i64 1, 1 + store %"int[]" %38, ptr %36, align 8 + %39 = insertvalue %"int[][]" undef, ptr %literal, 0 + %40 = insertvalue %"int[][]" %39, i64 1, 1 + store %"int[][]" %40, ptr %a, align 8 + %41 = getelementptr inbounds [1 x %"int[]"], ptr %literal5, i64 0, i64 0 + call void @llvm.memcpy.p0.p0.i32(ptr align 4 %literal6, ptr align 4 @.__const.2, i32 4, i1 false) + %42 = insertvalue %"int[]" undef, ptr %literal6, 0 + %43 = insertvalue %"int[]" %42, i64 1, 1 + store %"int[]" %43, ptr %41, align 8 + %44 = insertvalue %"int[][]" undef, ptr %literal5, 0 + %45 = insertvalue %"int[][]" %44, i64 1, 1 + store %"int[][]" %45, ptr %b, align 8 + %46 = insertvalue %any undef, ptr %a, 0 + %47 = insertvalue %any %46, i64 ptrtoint (ptr @"$ct.sa$sa$int" to i64), 1 + %48 = getelementptr inbounds [1 x %any], ptr %varargslots8, i64 0, i64 0 + store %any %47, ptr %48, align 16 + %49 = call i64 @std.io.printfn(ptr %retparam7, ptr @.str.3, i64 2, ptr %varargslots8, i64 1) + %50 = load %"int[][]", ptr %b, align 8 + %51 = extractvalue %"int[][]" %50, 0 + %ptroffset = getelementptr inbounds %"int[]", ptr %51, i64 0 + %52 = insertvalue %"int[][]" undef, ptr %ptroffset, 0 + %53 = insertvalue %"int[][]" %52, i64 1, 1 + %54 = load %"int[][]", ptr %a, align 8 + %55 = extractvalue %"int[][]" %54, 0 + %ptroffset9 = getelementptr inbounds %"int[]", ptr %55, i64 0 + %56 = insertvalue %"int[][]" undef, ptr %ptroffset9, 0 + %57 = insertvalue %"int[][]" %56, i64 1, 1 + %58 = extractvalue %"int[][]" %57, 0 + %59 = extractvalue %"int[][]" %53, 0 + store %"int[][]" %53, ptr %taddr10, align 8 + %60 = getelementptr inbounds %"int[][]", ptr %taddr10, i32 0, i32 1 + %61 = load i64, ptr %60, align 8 + %62 = mul i64 %61, 16 + call void @llvm.memcpy.p0.p0.i64(ptr align 8 %58, ptr align 8 %59, i64 %62, i1 false) + %63 = insertvalue %any undef, ptr %a, 0 + %64 = insertvalue %any %63, i64 ptrtoint (ptr @"$ct.sa$sa$int" to i64), 1 + %65 = getelementptr inbounds [1 x %any], ptr %varargslots12, i64 0, i64 0 + store %any %64, ptr %65, align 16 + %66 = call i64 @std.io.printfn(ptr %retparam11, ptr @.str.4, i64 2, ptr %varargslots12, i64 1) + %67 = getelementptr inbounds <6 x i32>, ptr %y, i64 0, i64 2 + %68 = insertvalue %"int[]" undef, ptr %67, 0 + %69 = insertvalue %"int[]" %68, i64 3, 1 + %70 = load %"int[][]", ptr %a, align 8 + %71 = extractvalue %"int[][]" %70, 0 + %ptroffset13 = getelementptr inbounds %"int[]", ptr %71, i64 0 + store %"int[]" %69, ptr %ptroffset13, align 8 + %72 = insertvalue %any undef, ptr %a, 0 + %73 = insertvalue %any %72, i64 ptrtoint (ptr @"$ct.sa$sa$int" to i64), 1 + %74 = getelementptr inbounds [1 x %any], ptr %varargslots15, i64 0, i64 0 + store %any %73, ptr %74, align 16 + %75 = call i64 @std.io.printfn(ptr %retparam14, ptr @.str.5, i64 2, ptr %varargslots15, i64 1) ret void } diff --git a/test/test_suite/statements/custom_foreach_with_ref.c3t b/test/test_suite/statements/custom_foreach_with_ref.c3t index 94fc6821d..56d85f3f2 100644 --- a/test/test_suite/statements/custom_foreach_with_ref.c3t +++ b/test/test_suite/statements/custom_foreach_with_ref.c3t @@ -87,20 +87,21 @@ fn void main() @"$ct.foo.Foo" = linkonce global %.introspect { i8 10, ptr null, i64 12, i64 0, i64 1, [0 x i64] zeroinitializer }, align 8 @.str = private unnamed_addr constant [11 x i8] c"getFields\0A\00", align 1 +@.__const = private unnamed_addr constant [5 x i32] [i32 3, i32 5, i32 2, i32 10, i32 111], align 16 @.str.1 = private unnamed_addr constant [11 x i8] c"Call made\0A\00", align 1 -@.__const = private unnamed_addr constant %Foo { [3 x i32] [i32 1, i32 5, i32 7] }, align 4 -@.str.2 = private unnamed_addr constant [10 x i8] c"%d %d %d\0A\00", align 1 -@.str.3 = private unnamed_addr constant [14 x i8] c"Hello %d: %d\0A\00", align 1 +@.__const.2 = private unnamed_addr constant %Foo { [3 x i32] [i32 1, i32 5, i32 7] }, align 4 +@.str.3 = private unnamed_addr constant [10 x i8] c"%d %d %d\0A\00", align 1 @.str.4 = private unnamed_addr constant [14 x i8] c"Hello %d: %d\0A\00", align 1 -@.str.5 = private unnamed_addr constant [18 x i8] c"After one %d: %d\0A\00", align 1 -@.str.6 = private unnamed_addr constant [19 x i8] c"By pointer %d: %d\0A\00", align 1 -@.str.7 = private unnamed_addr constant [15 x i8] c"Adding %d: %d\0A\00", align 1 -@.__const.8 = private unnamed_addr constant [5 x i32] [i32 1, i32 2, i32 10, i32 111, i32 123], align 16 -@.str.9 = private unnamed_addr constant [15 x i8] c"Adding %d: %d\0A\00", align 1 -@.str.10 = private unnamed_addr constant [19 x i8] c"Pull value %d: %d\0A\00", align 1 -@.str.11 = private unnamed_addr constant [27 x i8] c"Pull value tempptr %d: %d\0A\00", align 1 -@.str.12 = private unnamed_addr constant [7 x i8] c"%d %d\0A\00", align 1 +@.str.5 = private unnamed_addr constant [14 x i8] c"Hello %d: %d\0A\00", align 1 +@.str.6 = private unnamed_addr constant [18 x i8] c"After one %d: %d\0A\00", align 1 +@.str.7 = private unnamed_addr constant [19 x i8] c"By pointer %d: %d\0A\00", align 1 +@.str.8 = private unnamed_addr constant [15 x i8] c"Adding %d: %d\0A\00", align 1 +@.__const.9 = private unnamed_addr constant [5 x i32] [i32 1, i32 2, i32 10, i32 111, i32 123], align 16 +@.str.10 = private unnamed_addr constant [15 x i8] c"Adding %d: %d\0A\00", align 1 +@.str.11 = private unnamed_addr constant [19 x i8] c"Pull value %d: %d\0A\00", align 1 +@.str.12 = private unnamed_addr constant [27 x i8] c"Pull value tempptr %d: %d\0A\00", align 1 @.str.13 = private unnamed_addr constant [7 x i8] c"%d %d\0A\00", align 1 +@.str.14 = private unnamed_addr constant [7 x i8] c"%d %d\0A\00", align 1 ; Function Attrs: nounwind declare void @printf(ptr, ...) #0 @@ -110,26 +111,19 @@ define void @foo.getFields(ptr noalias sret([5 x i32]) align 4 %0) #0 { entry: %literal = alloca [5 x i32], align 16 call void (ptr, ...) @printf(ptr @.str) - %1 = getelementptr inbounds [5 x i32], ptr %literal, i64 0, i64 0 - store i32 3, ptr %1, align 4 - %2 = getelementptr inbounds [5 x i32], ptr %literal, i64 0, i64 1 - store i32 5, ptr %2, align 4 - %3 = getelementptr inbounds [5 x i32], ptr %literal, i64 0, i64 2 - store i32 2, ptr %3, align 4 - %4 = getelementptr inbounds [5 x i32], ptr %literal, i64 0, i64 3 - store i32 10, ptr %4, align 4 - %5 = getelementptr inbounds [5 x i32], ptr %literal, i64 0, i64 4 - store i32 111, ptr %5, align 4 + call void @llvm.memcpy.p0.p0.i32(ptr align 4 %literal, ptr align 16 @.__const, i32 20, i1 false) call void @llvm.memcpy.p0.p0.i32(ptr align 4 %0, ptr align 4 %literal, i32 20, i1 false) ret void } +; Function Attrs: nounwind define ptr @foo.call(ptr %0) #0 { entry: call void (ptr, ...) @printf(ptr @.str.1) ret ptr %0 } +; Function Attrs: nounwind define void @foo.main() #0 { entry: %x = alloca %Foo, align 4 @@ -173,7 +167,7 @@ entry: %i72 = alloca i64, align 8 %y73 = alloca i32, align 4 %y76 = alloca ptr, align 8 - call void @llvm.memcpy.p0.p0.i32(ptr align 4 %x, ptr align 4 @.__const, i32 12, i1 false) + call void @llvm.memcpy.p0.p0.i32(ptr align 4 %x, ptr align 4 @.__const.2, i32 12, i1 false) %0 = getelementptr inbounds %Foo, ptr %x, i32 0, i32 0 %1 = getelementptr inbounds [3 x i32], ptr %0, i64 0, i64 0 %2 = load i32, ptr %1, align 4 @@ -183,7 +177,7 @@ entry: %6 = getelementptr inbounds %Foo, ptr %x, i32 0, i32 0 %7 = getelementptr inbounds [3 x i32], ptr %6, i64 0, i64 2 %8 = load i32, ptr %7, align 4 - call void (ptr, ...) @printf(ptr @.str.2, i32 %2, i32 %5, i32 %8) + call void (ptr, ...) @printf(ptr @.str.3, i32 %2, i32 %5, i32 %8) %9 = call ptr @foo.call(ptr %x) store ptr %9, ptr %.anon, align 8 store i32 3, ptr %.anon1, align 4 @@ -210,7 +204,7 @@ loop.body: ; preds = %loop.cond store i32 %18, ptr %y, align 4 %19 = load i32, ptr %i, align 4 %20 = load i32, ptr %y, align 4 - call void (ptr, ...) @printf(ptr @.str.3, i32 %19, i32 %20) + call void (ptr, ...) @printf(ptr @.str.4, i32 %19, i32 %20) %21 = load i32, ptr %.anon2, align 4 %add = add i32 %21, 1 store i32 %add, ptr %.anon2, align 4 @@ -244,7 +238,7 @@ loop.body7: ; preds = %loop.cond5 %31 = load i32, ptr %i8, align 4 %32 = load ptr, ptr %y9, align 8 %33 = load i32, ptr %32, align 4 - call void (ptr, ...) @printf(ptr @.str.4, i32 %31, i32 %33) + call void (ptr, ...) @printf(ptr @.str.5, i32 %31, i32 %33) %34 = load i32, ptr %.anon4, align 4 %add13 = add i32 %34, 1 store i32 %add13, ptr %.anon4, align 4 @@ -274,7 +268,7 @@ loop.body19: ; preds = %loop.cond17 store i32 %42, ptr %y21, align 4 %43 = load i32, ptr %i20, align 4 %44 = load i32, ptr %y21, align 4 - call void (ptr, ...) @printf(ptr @.str.5, i32 %43, i32 %44) + call void (ptr, ...) @printf(ptr @.str.6, i32 %43, i32 %44) %45 = load i32, ptr %.anon16, align 4 %add24 = add i32 %45, 1 store i32 %add24, ptr %.anon16, align 4 @@ -304,7 +298,7 @@ loop.body30: ; preds = %loop.cond28 store i32 %53, ptr %y32, align 4 %54 = load i32, ptr %i31, align 4 %55 = load i32, ptr %y32, align 4 - call void (ptr, ...) @printf(ptr @.str.6, i32 %54, i32 %55) + call void (ptr, ...) @printf(ptr @.str.7, i32 %54, i32 %55) %56 = load i32, ptr %.anon27, align 4 %add35 = add i32 %56, 1 store i32 %add35, ptr %.anon27, align 4 @@ -334,7 +328,7 @@ loop.body41: ; preds = %loop.cond39 store i32 %64, ptr %y43, align 4 %65 = load i32, ptr %i42, align 4 %66 = load i32, ptr %y43, align 4 - call void (ptr, ...) @printf(ptr @.str.7, i32 %65, i32 %66) + call void (ptr, ...) @printf(ptr @.str.8, i32 %65, i32 %66) %67 = load i32, ptr %i42, align 4 %add46 = add i32 %67, 1 store i32 %add46, ptr %i42, align 4 @@ -344,7 +338,7 @@ loop.body41: ; preds = %loop.cond39 br label %loop.cond39 loop.exit48: ; preds = %loop.cond39 - call void @llvm.memcpy.p0.p0.i32(ptr align 16 %.anon49, ptr align 16 @.__const.8, i32 20, i1 false) + call void @llvm.memcpy.p0.p0.i32(ptr align 16 %.anon49, ptr align 16 @.__const.9, i32 20, i1 false) store i64 0, ptr %.anon50, align 8 br label %loop.cond51 @@ -362,7 +356,7 @@ loop.body52: ; preds = %loop.cond51 store i32 %73, ptr %y54, align 4 %74 = load i64, ptr %i53, align 8 %75 = load i32, ptr %y54, align 4 - call void (ptr, ...) @printf(ptr @.str.9, i64 %74, i32 %75) + call void (ptr, ...) @printf(ptr @.str.10, i64 %74, i32 %75) %76 = load i64, ptr %i53, align 8 %add55 = add i64 %76, 1 store i64 %add55, ptr %i53, align 8 @@ -390,7 +384,7 @@ loop.body62: ; preds = %loop.cond60 store i32 %82, ptr %y64, align 4 %83 = load i64, ptr %i63, align 8 %84 = load i32, ptr %y64, align 4 - call void (ptr, ...) @printf(ptr @.str.10, i64 %83, i32 %84) + call void (ptr, ...) @printf(ptr @.str.11, i64 %83, i32 %84) %85 = load i64, ptr %.anon59, align 8 %add65 = add i64 %85, 1 store i64 %add65, ptr %.anon59, align 8 @@ -417,7 +411,7 @@ loop.body71: ; preds = %loop.cond69 store i32 %91, ptr %y73, align 4 %92 = load i64, ptr %i72, align 8 %93 = load i32, ptr %y73, align 4 - call void (ptr, ...) @printf(ptr @.str.11, i64 %92, i32 %93) + call void (ptr, ...) @printf(ptr @.str.12, i64 %92, i32 %93) %94 = load i64, ptr %.anon68, align 8 %add74 = add i64 %94, 1 store i64 %add74, ptr %.anon68, align 8 @@ -430,7 +424,7 @@ loop.exit75: ; preds = %loop.cond69 %98 = getelementptr inbounds %Foo, ptr %x, i32 0, i32 0 %99 = getelementptr inbounds [3 x i32], ptr %98, i64 0, i64 1 %100 = load i32, ptr %99, align 4 - call void (ptr, ...) @printf(ptr @.str.12, i32 %97, i32 %100) + call void (ptr, ...) @printf(ptr @.str.13, i32 %97, i32 %100) %101 = getelementptr inbounds %Foo, ptr %x, i32 0, i32 0 %102 = getelementptr inbounds [3 x i32], ptr %101, i64 0, i64 1 store ptr %102, ptr %y76, align 8 @@ -444,6 +438,6 @@ loop.exit75: ; preds = %loop.cond69 %108 = getelementptr inbounds %Foo, ptr %x, i32 0, i32 0 %109 = getelementptr inbounds [3 x i32], ptr %108, i64 0, i64 1 %110 = load i32, ptr %109, align 4 - call void (ptr, ...) @printf(ptr @.str.13, i32 %107, i32 %110) + call void (ptr, ...) @printf(ptr @.str.14, i32 %107, i32 %110) ret void } diff --git a/test/test_suite/stdlib/map.c3t b/test/test_suite/stdlib/map.c3t index 495bf3267..e0fce457a 100644 --- a/test/test_suite/stdlib/map.c3t +++ b/test/test_suite/stdlib/map.c3t @@ -72,13 +72,14 @@ entry: %9 = insertvalue %any %8, i64 ptrtoint (ptr @"$ct.p$void" to i64), 1 %10 = getelementptr inbounds [2 x %any], ptr %varargslots, i64 0, i64 1 store %any %9, ptr %10, align 16 - %11 = call i64 @std.core.dstring.DString.printf(ptr %retparam, ptr %s, ptr @.str.12, i64 8, ptr %varargslots, i64 2) + %11 = call i64 @std.core.dstring.DString.printf(ptr %retparam, ptr %s, ptr @.str.14, i64 8, ptr %varargslots, i64 2) %12 = load ptr, ptr %s, align 8 %13 = call { ptr, i64 } @std.core.dstring.DString.as_str(ptr %12) store { ptr, i64 } %13, ptr %result, align 8 %14 = load { ptr, i64 }, ptr %result, align 8 ret { ptr, i64 } %14 } + ; Function Attrs: nounwind define void @test.main() #0 { entry: @@ -134,164 +135,162 @@ entry: %4 = getelementptr inbounds [1 x %any], ptr %varargslots, i64 0, i64 0 store %any %3, ptr %4, align 16 %5 = call i64 @std.io.printfn(ptr %retparam, ptr @.str, i64 12, ptr %varargslots, i64 1) - %6 = getelementptr inbounds %Foo, ptr %literal, i32 0, i32 0 - store i32 1, ptr %6, align 8 - %7 = getelementptr inbounds %Foo, ptr %literal, i32 0, i32 1 - store ptr null, ptr %7, align 8 - %8 = getelementptr inbounds { i64, ptr }, ptr %literal, i32 0, i32 0 - %lo = load i64, ptr %8, align 8 - %9 = getelementptr inbounds { i64, ptr }, ptr %literal, i32 0, i32 1 - %hi = load ptr, ptr %9, align 8 - %10 = call i8 @"std.collections.map$int$test.Foo$.HashMap.set"(ptr %map, i32 1, i64 %lo, ptr %hi) - %11 = getelementptr inbounds %HashMap, ptr %map, i32 0, i32 2 - %12 = insertvalue %any undef, ptr %11, 0 - %13 = insertvalue %any %12, i64 ptrtoint (ptr @"$ct.uint" to i64), 1 - %14 = getelementptr inbounds [1 x %any], ptr %varargslots2, i64 0, i64 0 - store %any %13, ptr %14, align 16 - %15 = call i64 @std.io.printfn(ptr %retparam1, ptr @.str.1, i64 12, ptr %varargslots2, i64 1) - %16 = getelementptr inbounds %Foo, ptr %literal3, i32 0, i32 0 - store i32 2, ptr %16, align 8 - %17 = getelementptr inbounds %Foo, ptr %literal3, i32 0, i32 1 - store ptr null, ptr %17, align 8 - %18 = getelementptr inbounds { i64, ptr }, ptr %literal3, i32 0, i32 0 - %lo4 = load i64, ptr %18, align 8 - %19 = getelementptr inbounds { i64, ptr }, ptr %literal3, i32 0, i32 1 - %hi5 = load ptr, ptr %19, align 8 - %20 = call i8 @"std.collections.map$int$test.Foo$.HashMap.set"(ptr %map, i32 1, i64 %lo4, ptr %hi5) - %21 = getelementptr inbounds %HashMap, ptr %map, i32 0, i32 2 - %22 = insertvalue %any undef, ptr %21, 0 - %23 = insertvalue %any %22, i64 ptrtoint (ptr @"$ct.uint" to i64), 1 - %24 = getelementptr inbounds [1 x %any], ptr %varargslots7, i64 0, i64 0 - store %any %23, ptr %24, align 16 - %25 = call i64 @std.io.printfn(ptr %retparam6, ptr @.str.2, i64 12, ptr %varargslots7, i64 1) - %26 = call i64 @"std.collections.map$int$test.Foo$.HashMap.get"(ptr %retparam10, ptr %map, i32 1) - %not_err = icmp eq i64 %26, 0 - %27 = call i1 @llvm.expect.i1(i1 %not_err, i1 true) - br i1 %27, label %after_check, label %after_check12 + call void @llvm.memcpy.p0.p0.i32(ptr align 8 %literal, ptr align 8 @.__const, i32 16, i1 false) + %6 = getelementptr inbounds { i64, ptr }, ptr %literal, i32 0, i32 0 + %lo = load i64, ptr %6, align 8 + %7 = getelementptr inbounds { i64, ptr }, ptr %literal, i32 0, i32 1 + %hi = load ptr, ptr %7, align 8 + %8 = call i8 @"std.collections.map$int$test.Foo$.HashMap.set"(ptr %map, i32 1, i64 %lo, ptr %hi) + %9 = getelementptr inbounds %HashMap, ptr %map, i32 0, i32 2 + %10 = insertvalue %any undef, ptr %9, 0 + %11 = insertvalue %any %10, i64 ptrtoint (ptr @"$ct.uint" to i64), 1 + %12 = getelementptr inbounds [1 x %any], ptr %varargslots2, i64 0, i64 0 + store %any %11, ptr %12, align 16 + %13 = call i64 @std.io.printfn(ptr %retparam1, ptr @.str.1, i64 12, ptr %varargslots2, i64 1) + call void @llvm.memcpy.p0.p0.i32(ptr align 8 %literal3, ptr align 8 @.__const.2, i32 16, i1 false) + %14 = getelementptr inbounds { i64, ptr }, ptr %literal3, i32 0, i32 0 + %lo4 = load i64, ptr %14, align 8 + %15 = getelementptr inbounds { i64, ptr }, ptr %literal3, i32 0, i32 1 + %hi5 = load ptr, ptr %15, align 8 + %16 = call i8 @"std.collections.map$int$test.Foo$.HashMap.set"(ptr %map, i32 1, i64 %lo4, ptr %hi5) + %17 = getelementptr inbounds %HashMap, ptr %map, i32 0, i32 2 + %18 = insertvalue %any undef, ptr %17, 0 + %19 = insertvalue %any %18, i64 ptrtoint (ptr @"$ct.uint" to i64), 1 + %20 = getelementptr inbounds [1 x %any], ptr %varargslots7, i64 0, i64 0 + store %any %19, ptr %20, align 16 + %21 = call i64 @std.io.printfn(ptr %retparam6, ptr @.str.3, i64 12, ptr %varargslots7, i64 1) + %22 = call i64 @"std.collections.map$int$test.Foo$.HashMap.get"(ptr %retparam10, ptr %map, i32 1) + %not_err = icmp eq i64 %22, 0 + %23 = call i1 @llvm.expect.i1(i1 %not_err, i1 true) + br i1 %23, label %after_check, label %after_check12 + after_check: ; preds = %entry - %28 = getelementptr inbounds %Foo, ptr %retparam10, i32 0, i32 0 - %29 = insertvalue %any undef, ptr %28, 0 - %30 = insertvalue %any %29, i64 ptrtoint (ptr @"$ct.int" to i64), 1 - %31 = getelementptr inbounds [1 x %any], ptr %varargslots9, i64 0, i64 0 - store %any %30, ptr %31, align 16 - %32 = call i64 @std.io.printfn(ptr %retparam8, ptr @.str.3, i64 7, ptr %varargslots9, i64 1) - %not_err11 = icmp eq i64 %32, 0 - %33 = call i1 @llvm.expect.i1(i1 %not_err11, i1 true) - br i1 %33, label %after_check12, label %after_check12 + %24 = getelementptr inbounds %Foo, ptr %retparam10, i32 0, i32 0 + %25 = insertvalue %any undef, ptr %24, 0 + %26 = insertvalue %any %25, i64 ptrtoint (ptr @"$ct.int" to i64), 1 + %27 = getelementptr inbounds [1 x %any], ptr %varargslots9, i64 0, i64 0 + store %any %26, ptr %27, align 16 + %28 = call i64 @std.io.printfn(ptr %retparam8, ptr @.str.4, i64 7, ptr %varargslots9, i64 1) + %not_err11 = icmp eq i64 %28, 0 + %29 = call i1 @llvm.expect.i1(i1 %not_err11, i1 true) + br i1 %29, label %after_check12, label %after_check12 + after_check12: ; preds = %entry, %after_check, %after_check - %34 = call i8 @"std.collections.map$int$test.Foo$.HashMap.has_key"(ptr %map, i32 1) - store i8 %34, ptr %taddr, align 1 - %35 = insertvalue %any undef, ptr %taddr, 0 - %36 = insertvalue %any %35, i64 ptrtoint (ptr @"$ct.bool" to i64), 1 - %37 = getelementptr inbounds [1 x %any], ptr %varargslots14, i64 0, i64 0 - store %any %36, ptr %37, align 16 - %38 = call i64 @std.io.printfn(ptr %retparam13, ptr @.str.4, i64 9, ptr %varargslots14, i64 1) - %39 = call i8 @"std.collections.map$int$test.Foo$.HashMap.has_key"(ptr %map, i32 2) - store i8 %39, ptr %taddr19, align 1 - %40 = insertvalue %any undef, ptr %taddr19, 0 - %41 = insertvalue %any %40, i64 ptrtoint (ptr @"$ct.bool" to i64), 1 - %42 = getelementptr inbounds [1 x %any], ptr %varargslots18, i64 0, i64 0 - store %any %41, ptr %42, align 16 - %43 = call i64 @std.io.printfn(ptr %retparam17, ptr @.str.5, i64 9, ptr %varargslots18, i64 1) - %44 = getelementptr inbounds %Foo, ptr %literal22, i32 0, i32 0 - store i32 4, ptr %44, align 8 - %45 = getelementptr inbounds %Foo, ptr %literal22, i32 0, i32 1 - store ptr null, ptr %45, align 8 - %46 = getelementptr inbounds { i64, ptr }, ptr %literal22, i32 0, i32 0 - %lo23 = load i64, ptr %46, align 8 - %47 = getelementptr inbounds { i64, ptr }, ptr %literal22, i32 0, i32 1 - %hi24 = load ptr, ptr %47, align 8 - %48 = call i8 @"std.collections.map$int$test.Foo$.HashMap.set"(ptr %map, i32 7, i64 %lo23, ptr %hi24) - %49 = load ptr, ptr @std.core.mem.thread_allocator, align 8 - %50 = call { ptr, i64 } @"std.collections.map$int$test.Foo$.HashMap.value_list"(ptr %map, ptr %49) - store { ptr, i64 } %50, ptr %result, align 8 - %51 = insertvalue %any undef, ptr %result, 0 - %52 = insertvalue %any %51, i64 ptrtoint (ptr @"$ct.sa$test.Foo" to i64), 1 - %53 = getelementptr inbounds [1 x %any], ptr %varargslots26, i64 0, i64 0 - store %any %52, ptr %53, align 16 - %54 = call i64 @std.io.printfn(ptr %retparam25, ptr @.str.6, i64 10, ptr %varargslots26, i64 1) + %30 = call i8 @"std.collections.map$int$test.Foo$.HashMap.has_key"(ptr %map, i32 1) + store i8 %30, ptr %taddr, align 1 + %31 = insertvalue %any undef, ptr %taddr, 0 + %32 = insertvalue %any %31, i64 ptrtoint (ptr @"$ct.bool" to i64), 1 + %33 = getelementptr inbounds [1 x %any], ptr %varargslots14, i64 0, i64 0 + store %any %32, ptr %33, align 16 + %34 = call i64 @std.io.printfn(ptr %retparam13, ptr @.str.5, i64 9, ptr %varargslots14, i64 1) + %35 = call i8 @"std.collections.map$int$test.Foo$.HashMap.has_key"(ptr %map, i32 2) + store i8 %35, ptr %taddr19, align 1 + %36 = insertvalue %any undef, ptr %taddr19, 0 + %37 = insertvalue %any %36, i64 ptrtoint (ptr @"$ct.bool" to i64), 1 + %38 = getelementptr inbounds [1 x %any], ptr %varargslots18, i64 0, i64 0 + store %any %37, ptr %38, align 16 + %39 = call i64 @std.io.printfn(ptr %retparam17, ptr @.str.6, i64 9, ptr %varargslots18, i64 1) + call void @llvm.memcpy.p0.p0.i32(ptr align 8 %literal22, ptr align 8 @.__const.7, i32 16, i1 false) + %40 = getelementptr inbounds { i64, ptr }, ptr %literal22, i32 0, i32 0 + %lo23 = load i64, ptr %40, align 8 + %41 = getelementptr inbounds { i64, ptr }, ptr %literal22, i32 0, i32 1 + %hi24 = load ptr, ptr %41, align 8 + %42 = call i8 @"std.collections.map$int$test.Foo$.HashMap.set"(ptr %map, i32 7, i64 %lo23, ptr %hi24) + %43 = load ptr, ptr @std.core.mem.thread_allocator, align 8 + %44 = call { ptr, i64 } @"std.collections.map$int$test.Foo$.HashMap.value_list"(ptr %map, ptr %43) + store { ptr, i64 } %44, ptr %result, align 8 + %45 = insertvalue %any undef, ptr %result, 0 + %46 = insertvalue %any %45, i64 ptrtoint (ptr @"$ct.sa$test.Foo" to i64), 1 + %47 = getelementptr inbounds [1 x %any], ptr %varargslots26, i64 0, i64 0 + store %any %46, ptr %47, align 16 + %48 = call i64 @std.io.printfn(ptr %retparam25, ptr @.str.8, i64 10, ptr %varargslots26, i64 1) call void @llvm.memset.p0.i64(ptr align 8 %map2, i8 0, i64 40, i1 false) - %55 = load ptr, ptr @std.core.mem.thread_allocator, align 8 - call void @"std.collections.map$int$double$.HashMap.init"(ptr %map2, i32 16, float 7.500000e-01, ptr %55) - %56 = call i8 @"std.collections.map$int$double$.HashMap.set"(ptr %map2, i32 4, double 1.300000e+00) - %57 = call i8 @"std.collections.map$int$double$.HashMap.has_value"(ptr %map2, double 1.300000e+00) - store i8 %57, ptr %taddr31, align 1 - %58 = insertvalue %any undef, ptr %taddr31, 0 - %59 = insertvalue %any %58, i64 ptrtoint (ptr @"$ct.bool" to i64), 1 - %60 = getelementptr inbounds [1 x %any], ptr %varargslots30, i64 0, i64 0 - store %any %59, ptr %60, align 16 - %61 = call i64 @std.io.printfn(ptr %retparam29, ptr @.str.7, i64 12, ptr %varargslots30, i64 1) - %62 = call i8 @"std.collections.map$int$double$.HashMap.has_value"(ptr %map2, double 1.200000e+00) - store i8 %62, ptr %taddr36, align 1 - %63 = insertvalue %any undef, ptr %taddr36, 0 - %64 = insertvalue %any %63, i64 ptrtoint (ptr @"$ct.bool" to i64), 1 - %65 = getelementptr inbounds [1 x %any], ptr %varargslots35, i64 0, i64 0 - store %any %64, ptr %65, align 16 - %66 = call i64 @std.io.printfn(ptr %retparam34, ptr @.str.8, i64 12, ptr %varargslots35, i64 1) - %67 = call i8 @"std.collections.map$int$double$.HashMap.set"(ptr %map2, i32 100, double 3.400000e+00) + %49 = load ptr, ptr @std.core.mem.thread_allocator, align 8 + call void @"std.collections.map$int$double$.HashMap.init"(ptr %map2, i32 16, float 7.500000e-01, ptr %49) + %50 = call i8 @"std.collections.map$int$double$.HashMap.set"(ptr %map2, i32 4, double 1.300000e+00) + %51 = call i8 @"std.collections.map$int$double$.HashMap.has_value"(ptr %map2, double 1.300000e+00) + store i8 %51, ptr %taddr31, align 1 + %52 = insertvalue %any undef, ptr %taddr31, 0 + %53 = insertvalue %any %52, i64 ptrtoint (ptr @"$ct.bool" to i64), 1 + %54 = getelementptr inbounds [1 x %any], ptr %varargslots30, i64 0, i64 0 + store %any %53, ptr %54, align 16 + %55 = call i64 @std.io.printfn(ptr %retparam29, ptr @.str.9, i64 12, ptr %varargslots30, i64 1) + %56 = call i8 @"std.collections.map$int$double$.HashMap.has_value"(ptr %map2, double 1.200000e+00) + store i8 %56, ptr %taddr36, align 1 + %57 = insertvalue %any undef, ptr %taddr36, 0 + %58 = insertvalue %any %57, i64 ptrtoint (ptr @"$ct.bool" to i64), 1 + %59 = getelementptr inbounds [1 x %any], ptr %varargslots35, i64 0, i64 0 + store %any %58, ptr %59, align 16 + %60 = call i64 @std.io.printfn(ptr %retparam34, ptr @.str.10, i64 12, ptr %varargslots35, i64 1) + %61 = call i8 @"std.collections.map$int$double$.HashMap.set"(ptr %map2, i32 100, double 3.400000e+00) + %62 = load ptr, ptr @std.core.mem.thread_allocator, align 8 + %63 = call { ptr, i64 } @"std.collections.map$int$double$.HashMap.key_list"(ptr %map2, ptr %62) + store { ptr, i64 } %63, ptr %result41, align 8 + %64 = insertvalue %any undef, ptr %result41, 0 + %65 = insertvalue %any %64, i64 ptrtoint (ptr @"$ct.sa$int" to i64), 1 + %66 = getelementptr inbounds [1 x %any], ptr %varargslots40, i64 0, i64 0 + store %any %65, ptr %66, align 16 + %67 = call i64 @std.io.printfn(ptr %retparam39, ptr @.str.11, i64 2, ptr %varargslots40, i64 1) %68 = load ptr, ptr @std.core.mem.thread_allocator, align 8 - %69 = call { ptr, i64 } @"std.collections.map$int$double$.HashMap.key_list"(ptr %map2, ptr %68) - store { ptr, i64 } %69, ptr %result41, align 8 - %70 = insertvalue %any undef, ptr %result41, 0 - %71 = insertvalue %any %70, i64 ptrtoint (ptr @"$ct.sa$int" to i64), 1 - %72 = getelementptr inbounds [1 x %any], ptr %varargslots40, i64 0, i64 0 + %69 = call { ptr, i64 } @"std.collections.map$int$double$.HashMap.value_list"(ptr %map2, ptr %68) + store { ptr, i64 } %69, ptr %result46, align 8 + %70 = insertvalue %any undef, ptr %result46, 0 + %71 = insertvalue %any %70, i64 ptrtoint (ptr @"$ct.sa$double" to i64), 1 + %72 = getelementptr inbounds [1 x %any], ptr %varargslots45, i64 0, i64 0 store %any %71, ptr %72, align 16 - %73 = call i64 @std.io.printfn(ptr %retparam39, ptr @.str.9, i64 2, ptr %varargslots40, i64 1) - %74 = load ptr, ptr @std.core.mem.thread_allocator, align 8 - %75 = call { ptr, i64 } @"std.collections.map$int$double$.HashMap.value_list"(ptr %map2, ptr %74) - store { ptr, i64 } %75, ptr %result46, align 8 - %76 = insertvalue %any undef, ptr %result46, 0 - %77 = insertvalue %any %76, i64 ptrtoint (ptr @"$ct.sa$double" to i64), 1 - %78 = getelementptr inbounds [1 x %any], ptr %varargslots45, i64 0, i64 0 - store %any %77, ptr %78, align 16 - %79 = call i64 @std.io.printfn(ptr %retparam44, ptr @.str.10, i64 2, ptr %varargslots45, i64 1) - %80 = load ptr, ptr @std.core.mem.thread_temp_allocator, align 8 - %not = icmp eq ptr %80, null + %73 = call i64 @std.io.printfn(ptr %retparam44, ptr @.str.12, i64 2, ptr %varargslots45, i64 1) + %74 = load ptr, ptr @std.core.mem.thread_temp_allocator, align 8 + %not = icmp eq ptr %74, null br i1 %not, label %if.then, label %if.exit + if.then: ; preds = %after_check12 call void @std.core.mem.init_default_temp_allocators() br label %if.exit + if.exit: ; preds = %if.then, %after_check12 - %81 = load ptr, ptr @std.core.mem.thread_temp_allocator, align 8 - store ptr %81, ptr %current, align 8 - %82 = load ptr, ptr %current, align 8 - %83 = getelementptr inbounds %TempAllocator, ptr %82, i32 0, i32 3 - %84 = load i64, ptr %83, align 8 - store i64 %84, ptr %mark, align 8 + %75 = load ptr, ptr @std.core.mem.thread_temp_allocator, align 8 + store ptr %75, ptr %current, align 8 + %76 = load ptr, ptr %current, align 8 + %77 = getelementptr inbounds %TempAllocator, ptr %76, i32 0, i32 3 + %78 = load i64, ptr %77, align 8 + store i64 %78, ptr %mark, align 8 call void @llvm.memset.p0.i64(ptr align 8 %map3, i8 0, i64 40, i1 false) - %85 = load ptr, ptr @std.core.mem.thread_allocator, align 8 - call void @"std.collections.map$int$double$.HashMap.init"(ptr %map3, i32 16, float 7.500000e-01, ptr %85) - %86 = call i8 @"std.collections.map$int$double$.HashMap.set"(ptr %map3, i32 5, double 3.200000e+00) - %87 = call i8 @"std.collections.map$int$double$.HashMap.set"(ptr %map3, i32 7, double 5.200000e+00) - %88 = load ptr, ptr @std.core.mem.thread_allocator, align 8 - %89 = call { ptr, i64 } @"std.collections.map$int$double$.HashMap.key_list"(ptr %map3, ptr %88) - store { ptr, i64 } %89, ptr %result51, align 8 - %90 = insertvalue %any undef, ptr %result51, 0 - %91 = insertvalue %any %90, i64 ptrtoint (ptr @"$ct.sa$int" to i64), 1 - %92 = getelementptr inbounds [1 x %any], ptr %varargslots50, i64 0, i64 0 - store %any %91, ptr %92, align 16 - %93 = call i64 @std.io.printfn(ptr %retparam49, ptr @.str.11, i64 2, ptr %varargslots50, i64 1) - %94 = load ptr, ptr %current, align 8 - %95 = getelementptr inbounds %TempAllocator, ptr %94, i32 0, i32 0 - %96 = load i64, ptr %mark, align 8 - store i64 %96, ptr %mark54, align 8 - %97 = getelementptr inbounds %Allocator, ptr %95, i32 0, i32 0 - %98 = load ptr, ptr %97, align 8 - %99 = load i64, ptr %mark54, align 8 - %100 = call i64 %98(ptr %retparam55, ptr %95, i64 %99, i64 0, i64 0, ptr null, i32 8) + %79 = load ptr, ptr @std.core.mem.thread_allocator, align 8 + call void @"std.collections.map$int$double$.HashMap.init"(ptr %map3, i32 16, float 7.500000e-01, ptr %79) + %80 = call i8 @"std.collections.map$int$double$.HashMap.set"(ptr %map3, i32 5, double 3.200000e+00) + %81 = call i8 @"std.collections.map$int$double$.HashMap.set"(ptr %map3, i32 7, double 5.200000e+00) + %82 = load ptr, ptr @std.core.mem.thread_allocator, align 8 + %83 = call { ptr, i64 } @"std.collections.map$int$double$.HashMap.key_list"(ptr %map3, ptr %82) + store { ptr, i64 } %83, ptr %result51, align 8 + %84 = insertvalue %any undef, ptr %result51, 0 + %85 = insertvalue %any %84, i64 ptrtoint (ptr @"$ct.sa$int" to i64), 1 + %86 = getelementptr inbounds [1 x %any], ptr %varargslots50, i64 0, i64 0 + store %any %85, ptr %86, align 16 + %87 = call i64 @std.io.printfn(ptr %retparam49, ptr @.str.13, i64 2, ptr %varargslots50, i64 1) + %88 = load ptr, ptr %current, align 8 + %89 = getelementptr inbounds %TempAllocator, ptr %88, i32 0, i32 0 + %90 = load i64, ptr %mark, align 8 + store i64 %90, ptr %mark54, align 8 + %91 = getelementptr inbounds %Allocator, ptr %89, i32 0, i32 0 + %92 = load ptr, ptr %91, align 8 + %93 = load i64, ptr %mark54, align 8 + %94 = call i64 %92(ptr %retparam55, ptr %89, i64 %93, i64 0, i64 0, ptr null, i32 8) ret void } define internal void @.static_initialize.0() { entry: br label %dtable_check + dtable_check: ; preds = %dtable_next, %entry %dtable_ref = phi ptr [ getelementptr inbounds (%.introspect, ptr @"$ct.test.Foo", i32 0, i32 1), %entry ], [ %next_dtable_ref, %dtable_next ] %dtable_ptr = load ptr, ptr %dtable_ref, align 8 %0 = icmp eq ptr %dtable_ptr, null br i1 %0, label %dtable_found, label %dtable_next + dtable_next: ; preds = %dtable_check %next_dtable_ref = getelementptr inbounds { ptr, ptr, ptr }, ptr %dtable_ptr, i32 0, i32 2 br label %dtable_check + dtable_found: ; preds = %dtable_check store ptr @"$ct.dyn.test.Foo.to_string", ptr %dtable_ref, align 8 ret void