diff --git a/src/lfortran/semantics/ast_body_visitor.cpp b/src/lfortran/semantics/ast_body_visitor.cpp index 3472a2ee11..0baa680025 100644 --- a/src/lfortran/semantics/ast_body_visitor.cpp +++ b/src/lfortran/semantics/ast_body_visitor.cpp @@ -463,6 +463,7 @@ class BodyVisitor : public CommonVisitor { *args[i] = ASRUtils::EXPR(tmp); } } + std::vector newline_for_advance; for( std::uint32_t i = 0; i < n_kwargs; i++ ) { AST::kw_argstar_t kwarg = m_kwargs[i]; std::string m_arg_str(kwarg.m_arg); @@ -569,7 +570,7 @@ class BodyVisitor : public CommonVisitor { nullptr, 0, nullptr, newline))); // TODO: Compare with "no" (case-insensitive) in else part // Throw runtime error if advance expression does not match "no" - tmp_vec.push_back(ASR::make_If_t(al, loc, test, body.p, + newline_for_advance.push_back(ASR::make_If_t(al, loc, test, body.p, body.size(), nullptr, 0)); a_end = empty; } @@ -579,15 +580,18 @@ class BodyVisitor : public CommonVisitor { throw SemanticError(R"""(List directed format(*) is not allowed with a ADVANCE= specifier)""", loc); } - if (_type == AST::stmtType::Write) { - a_fmt_constant = a_fmt; - } else if (_type == AST::stmtType::Write && a_fmt == nullptr + if (_type == AST::stmtType::Write && a_fmt == nullptr && compiler_options.print_leading_space) { - ASR::ttype_t *str_type_len_0 = ASRUtils::TYPE(ASR::make_Character_t( - al, loc, 1, 0, nullptr)); - ASR::expr_t *empty_string = ASRUtils::EXPR(ASR::make_StringConstant_t( - al, loc, s2c(al, ""), str_type_len_0)); - a_values_vec.push_back(al, empty_string); + ASR::asr_t* file_write_asr_t = construct_leading_space(false, loc); + ASR::FileWrite_t* file_write = ASR::down_cast(ASRUtils::STMT(file_write_asr_t)); + file_write->m_id = a_id; + file_write->m_iomsg = a_iomsg; + file_write->m_iostat = a_iostat; + file_write->m_unit = a_unit; + file_write->m_label = m_label; + tmp_vec.push_back(file_write_asr_t); + } else if (_type == AST::stmtType::Write) { + a_fmt_constant = a_fmt; } for( std::uint32_t i = 0; i < n_values; i++ ) { this->visit_expr(*m_values[i]); @@ -642,7 +646,8 @@ class BodyVisitor : public CommonVisitor { } } - tmp_vec.insert(tmp_vec.begin(), tmp); + tmp_vec.push_back(tmp); + tmp_vec.insert(tmp_vec.end(), newline_for_advance.begin(), newline_for_advance.end()); tmp = nullptr; } @@ -2792,6 +2797,28 @@ class BodyVisitor : public CommonVisitor { throw LCompilersException("Argument not found"); } + ASR::asr_t* construct_leading_space(bool print, const Location &loc) { + ASR::ttype_t *str_type_len_0 = ASRUtils::TYPE(ASR::make_Character_t( + al, loc, 1, 0, nullptr)); + ASR::expr_t *empty_string = ASRUtils::EXPR(ASR::make_StringConstant_t( + al, loc, s2c(al, ""), str_type_len_0)); + ASR::ttype_t *str_type_len_1 = ASRUtils::TYPE(ASR::make_Character_t( + al, loc, 1, 1, nullptr)); + ASR::expr_t *space = ASRUtils::EXPR(ASR::make_StringConstant_t( + al, loc, s2c(al, " "), str_type_len_1)); + Vec args; + args.reserve(al, 1); + args.push_back(al, space); + + if (print) { + return ASR::make_Print_t(al, loc, + args.p, args.size(), nullptr, empty_string); + } else { + return ASR::make_FileWrite_t(al, loc, 0, nullptr, nullptr, + nullptr, nullptr, args.p, args.size(), nullptr, empty_string); + } + } + void visit_Print(const AST::Print_t &x) { Vec body; body.reserve(al, x.n_values); @@ -2802,11 +2829,7 @@ class BodyVisitor : public CommonVisitor { fmt = ASRUtils::EXPR(tmp); } else { if (compiler_options.print_leading_space) { - ASR::ttype_t *str_type_len_0 = ASRUtils::TYPE(ASR::make_Character_t( - al, x.base.base.loc, 1, 0, nullptr)); - ASR::expr_t *empty_string = ASRUtils::EXPR(ASR::make_StringConstant_t( - al, x.base.base.loc, s2c(al, ""), str_type_len_0)); - body.push_back(al, empty_string); + current_body->push_back(al, ASRUtils::STMT(construct_leading_space(true, x.base.base.loc))); } } diff --git a/src/libasr/asr_utils.cpp b/src/libasr/asr_utils.cpp index db2dd75432..df2bfbea52 100644 --- a/src/libasr/asr_utils.cpp +++ b/src/libasr/asr_utils.cpp @@ -1441,7 +1441,7 @@ void make_ArrayBroadcast_t_util(Allocator& al, const Location& loc, Vec shape_args; shape_args.reserve(al, 1); shape_args.push_back(al, expr1); - bool is_value_character_array = ASR::is_a(*ASRUtils::type_get_past_array(ASRUtils::type_get_past_allocatable(ASRUtils::expr_type(expr2)))); + bool is_value_character_array = ASRUtils::is_character(*ASRUtils::expr_type(expr2)); Vec dims; dims.reserve(al, 1); @@ -1564,7 +1564,7 @@ int64_t compute_leading_zeros(int64_t number, int64_t kind) { if (number%2 == 0) { leading_zeros++; } else { - leading_zeros = 0; + leading_zeros = 0; } number = number/2; total_bits--; diff --git a/src/libasr/codegen/asr_to_llvm.cpp b/src/libasr/codegen/asr_to_llvm.cpp index 8fbb2b903e..d9ca8e6cba 100644 --- a/src/libasr/codegen/asr_to_llvm.cpp +++ b/src/libasr/codegen/asr_to_llvm.cpp @@ -7770,7 +7770,9 @@ class ASRToLLVMVisitor : public ASR::BaseVisitor for (size_t i=0; i(*ASRUtils::type_get_past_allocatable(ASRUtils::type_get_past_array(ASRUtils::expr_type(x.m_values[i-1]))))) { + if (global_sep_space && + !(ASRUtils::is_character(*ASRUtils::expr_type(x.m_values[i])) + && ASRUtils::is_character(*ASRUtils::expr_type(x.m_values[i - 1])))) { args.push_back(sep); } else { sep_no_space = sep_no_space != nullptr ? sep_no_space : builder->CreateGlobalStringPtr(""); diff --git a/tests/reference/asr-print3-5f4fc26.json b/tests/reference/asr-print3-5f4fc26.json index 84c90822f8..7b0b1048f1 100644 --- a/tests/reference/asr-print3-5f4fc26.json +++ b/tests/reference/asr-print3-5f4fc26.json @@ -6,7 +6,7 @@ "outfile": null, "outfile_hash": null, "stdout": "asr-print3-5f4fc26.stdout", - "stdout_hash": "6048701ca9858c74f2376251ba655c5f775af9692dc769236951a0ba", + "stdout_hash": "ca47f6102543449b6d2a0ae1ee52a4beca2b8b475dedb33c24a7b465", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/asr-print3-5f4fc26.stdout b/tests/reference/asr-print3-5f4fc26.stdout index 0076bb212f..9db371feb7 100644 --- a/tests/reference/asr-print3-5f4fc26.stdout +++ b/tests/reference/asr-print3-5f4fc26.stdout @@ -33,10 +33,17 @@ ) (Print [(StringConstant + " " + (Character 1 1 ()) + )] + () + (StringConstant "" (Character 1 0 ()) ) - (StringConstant + ) + (Print + [(StringConstant "x is " (Character 1 5 ()) ) @@ -44,6 +51,22 @@ () () ) + (FileWrite + 0 + () + () + () + () + [(StringConstant + " " + (Character 1 1 ()) + )] + () + (StringConstant + "" + (Character 1 0 ()) + ) + ) (FileWrite 0 () @@ -60,16 +83,39 @@ ) (Print [(StringConstant + " " + (Character 1 1 ()) + )] + () + (StringConstant "" (Character 1 0 ()) ) - (StringConstant + ) + (Print + [(StringConstant "ok" (Character 1 2 ()) )] () () ) + (FileWrite + 0 + () + () + () + () + [(StringConstant + " " + (Character 1 1 ()) + )] + () + (StringConstant + "" + (Character 1 0 ()) + ) + ) (FileWrite 0 () diff --git a/tests/reference/llvm-case_02-a38c2d8.json b/tests/reference/llvm-case_02-a38c2d8.json index b8d0b5fb62..311023f277 100644 --- a/tests/reference/llvm-case_02-a38c2d8.json +++ b/tests/reference/llvm-case_02-a38c2d8.json @@ -6,7 +6,7 @@ "outfile": null, "outfile_hash": null, "stdout": "llvm-case_02-a38c2d8.stdout", - "stdout_hash": "076935608adff38e844b67a2460187766248daf42ea9fe1163ecb652", + "stdout_hash": "240f92ac3f84d11d9dd23f6542676bb14bb411fce5bbbf7db91fc312", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/llvm-case_02-a38c2d8.stdout b/tests/reference/llvm-case_02-a38c2d8.stdout index 63ce9f0bc7..0ab39c37d9 100644 --- a/tests/reference/llvm-case_02-a38c2d8.stdout +++ b/tests/reference/llvm-case_02-a38c2d8.stdout @@ -32,77 +32,74 @@ source_filename = "LFortran" @28 = private unnamed_addr constant [2 x i8] c" \00", align 1 @29 = private unnamed_addr constant [2 x i8] c"\0A\00", align 1 @30 = private unnamed_addr constant [16 x i8] c"Your marks are \00", align 1 -@31 = private unnamed_addr constant [1 x i8] zeroinitializer, align 1 -@32 = private unnamed_addr constant [9 x i8] c"%s%s%d%s\00", align 1 -@33 = private unnamed_addr constant [11 x i8] c"ERROR STOP\00", align 1 -@34 = private unnamed_addr constant [2 x i8] c"\0A\00", align 1 -@35 = private unnamed_addr constant [5 x i8] c"%s%s\00", align 1 -@36 = private unnamed_addr constant [2 x i8] c" \00", align 1 -@37 = private unnamed_addr constant [2 x i8] c"\0A\00", align 1 -@38 = private unnamed_addr constant [11 x i8] c"Excellent!\00", align 1 -@39 = private unnamed_addr constant [5 x i8] c"%s%s\00", align 1 -@40 = private unnamed_addr constant [2 x i8] c" \00", align 1 -@41 = private unnamed_addr constant [2 x i8] c"\0A\00", align 1 -@42 = private unnamed_addr constant [11 x i8] c"Very good!\00", align 1 -@43 = private unnamed_addr constant [5 x i8] c"%s%s\00", align 1 -@44 = private unnamed_addr constant [2 x i8] c" \00", align 1 -@45 = private unnamed_addr constant [2 x i8] c"\0A\00", align 1 -@46 = private unnamed_addr constant [11 x i8] c"Well done!\00", align 1 -@47 = private unnamed_addr constant [5 x i8] c"%s%s\00", align 1 -@48 = private unnamed_addr constant [2 x i8] c" \00", align 1 -@49 = private unnamed_addr constant [2 x i8] c"\0A\00", align 1 -@50 = private unnamed_addr constant [9 x i8] c"Not bad!\00", align 1 -@51 = private unnamed_addr constant [5 x i8] c"%s%s\00", align 1 -@52 = private unnamed_addr constant [2 x i8] c" \00", align 1 -@53 = private unnamed_addr constant [2 x i8] c"\0A\00", align 1 -@54 = private unnamed_addr constant [12 x i8] c"You passed!\00", align 1 -@55 = private unnamed_addr constant [5 x i8] c"%s%s\00", align 1 -@56 = private unnamed_addr constant [2 x i8] c" \00", align 1 -@57 = private unnamed_addr constant [2 x i8] c"\0A\00", align 1 -@58 = private unnamed_addr constant [18 x i8] c"Better try again!\00", align 1 -@59 = private unnamed_addr constant [5 x i8] c"%s%s\00", align 1 -@60 = private unnamed_addr constant [2 x i8] c" \00", align 1 -@61 = private unnamed_addr constant [2 x i8] c"\0A\00", align 1 -@62 = private unnamed_addr constant [14 x i8] c"Invalid marks\00", align 1 -@63 = private unnamed_addr constant [5 x i8] c"%s%s\00", align 1 -@64 = private unnamed_addr constant [2 x i8] c" \00", align 1 -@65 = private unnamed_addr constant [2 x i8] c"\0A\00", align 1 -@66 = private unnamed_addr constant [16 x i8] c"Your marks are \00", align 1 -@67 = private unnamed_addr constant [1 x i8] zeroinitializer, align 1 -@68 = private unnamed_addr constant [9 x i8] c"%s%s%d%s\00", align 1 -@69 = private unnamed_addr constant [2 x i8] c" \00", align 1 -@70 = private unnamed_addr constant [2 x i8] c"\0A\00", align 1 -@71 = private unnamed_addr constant [11 x i8] c"Excellent!\00", align 1 -@72 = private unnamed_addr constant [5 x i8] c"%s%s\00", align 1 -@73 = private unnamed_addr constant [2 x i8] c" \00", align 1 -@74 = private unnamed_addr constant [2 x i8] c"\0A\00", align 1 -@75 = private unnamed_addr constant [11 x i8] c"Very good!\00", align 1 -@76 = private unnamed_addr constant [5 x i8] c"%s%s\00", align 1 -@77 = private unnamed_addr constant [2 x i8] c" \00", align 1 -@78 = private unnamed_addr constant [2 x i8] c"\0A\00", align 1 -@79 = private unnamed_addr constant [11 x i8] c"Well done!\00", align 1 -@80 = private unnamed_addr constant [5 x i8] c"%s%s\00", align 1 -@81 = private unnamed_addr constant [2 x i8] c" \00", align 1 -@82 = private unnamed_addr constant [2 x i8] c"\0A\00", align 1 -@83 = private unnamed_addr constant [9 x i8] c"Not bad!\00", align 1 -@84 = private unnamed_addr constant [5 x i8] c"%s%s\00", align 1 -@85 = private unnamed_addr constant [2 x i8] c" \00", align 1 -@86 = private unnamed_addr constant [2 x i8] c"\0A\00", align 1 -@87 = private unnamed_addr constant [12 x i8] c"You passed!\00", align 1 -@88 = private unnamed_addr constant [5 x i8] c"%s%s\00", align 1 -@89 = private unnamed_addr constant [2 x i8] c" \00", align 1 -@90 = private unnamed_addr constant [2 x i8] c"\0A\00", align 1 -@91 = private unnamed_addr constant [18 x i8] c"Better try again!\00", align 1 -@92 = private unnamed_addr constant [5 x i8] c"%s%s\00", align 1 -@93 = private unnamed_addr constant [2 x i8] c" \00", align 1 -@94 = private unnamed_addr constant [2 x i8] c"\0A\00", align 1 -@95 = private unnamed_addr constant [14 x i8] c"Invalid marks\00", align 1 -@96 = private unnamed_addr constant [5 x i8] c"%s%s\00", align 1 -@97 = private unnamed_addr constant [2 x i8] c" \00", align 1 -@98 = private unnamed_addr constant [2 x i8] c"\0A\00", align 1 -@99 = private unnamed_addr constant [16 x i8] c"Your marks are \00", align 1 -@100 = private unnamed_addr constant [1 x i8] zeroinitializer, align 1 -@101 = private unnamed_addr constant [9 x i8] c"%s%s%d%s\00", align 1 +@31 = private unnamed_addr constant [9 x i8] c"%s%s%d%s\00", align 1 +@32 = private unnamed_addr constant [11 x i8] c"ERROR STOP\00", align 1 +@33 = private unnamed_addr constant [2 x i8] c"\0A\00", align 1 +@34 = private unnamed_addr constant [5 x i8] c"%s%s\00", align 1 +@35 = private unnamed_addr constant [2 x i8] c" \00", align 1 +@36 = private unnamed_addr constant [2 x i8] c"\0A\00", align 1 +@37 = private unnamed_addr constant [11 x i8] c"Excellent!\00", align 1 +@38 = private unnamed_addr constant [5 x i8] c"%s%s\00", align 1 +@39 = private unnamed_addr constant [2 x i8] c" \00", align 1 +@40 = private unnamed_addr constant [2 x i8] c"\0A\00", align 1 +@41 = private unnamed_addr constant [11 x i8] c"Very good!\00", align 1 +@42 = private unnamed_addr constant [5 x i8] c"%s%s\00", align 1 +@43 = private unnamed_addr constant [2 x i8] c" \00", align 1 +@44 = private unnamed_addr constant [2 x i8] c"\0A\00", align 1 +@45 = private unnamed_addr constant [11 x i8] c"Well done!\00", align 1 +@46 = private unnamed_addr constant [5 x i8] c"%s%s\00", align 1 +@47 = private unnamed_addr constant [2 x i8] c" \00", align 1 +@48 = private unnamed_addr constant [2 x i8] c"\0A\00", align 1 +@49 = private unnamed_addr constant [9 x i8] c"Not bad!\00", align 1 +@50 = private unnamed_addr constant [5 x i8] c"%s%s\00", align 1 +@51 = private unnamed_addr constant [2 x i8] c" \00", align 1 +@52 = private unnamed_addr constant [2 x i8] c"\0A\00", align 1 +@53 = private unnamed_addr constant [12 x i8] c"You passed!\00", align 1 +@54 = private unnamed_addr constant [5 x i8] c"%s%s\00", align 1 +@55 = private unnamed_addr constant [2 x i8] c" \00", align 1 +@56 = private unnamed_addr constant [2 x i8] c"\0A\00", align 1 +@57 = private unnamed_addr constant [18 x i8] c"Better try again!\00", align 1 +@58 = private unnamed_addr constant [5 x i8] c"%s%s\00", align 1 +@59 = private unnamed_addr constant [2 x i8] c" \00", align 1 +@60 = private unnamed_addr constant [2 x i8] c"\0A\00", align 1 +@61 = private unnamed_addr constant [14 x i8] c"Invalid marks\00", align 1 +@62 = private unnamed_addr constant [5 x i8] c"%s%s\00", align 1 +@63 = private unnamed_addr constant [2 x i8] c" \00", align 1 +@64 = private unnamed_addr constant [2 x i8] c"\0A\00", align 1 +@65 = private unnamed_addr constant [16 x i8] c"Your marks are \00", align 1 +@66 = private unnamed_addr constant [9 x i8] c"%s%s%d%s\00", align 1 +@67 = private unnamed_addr constant [2 x i8] c" \00", align 1 +@68 = private unnamed_addr constant [2 x i8] c"\0A\00", align 1 +@69 = private unnamed_addr constant [11 x i8] c"Excellent!\00", align 1 +@70 = private unnamed_addr constant [5 x i8] c"%s%s\00", align 1 +@71 = private unnamed_addr constant [2 x i8] c" \00", align 1 +@72 = private unnamed_addr constant [2 x i8] c"\0A\00", align 1 +@73 = private unnamed_addr constant [11 x i8] c"Very good!\00", align 1 +@74 = private unnamed_addr constant [5 x i8] c"%s%s\00", align 1 +@75 = private unnamed_addr constant [2 x i8] c" \00", align 1 +@76 = private unnamed_addr constant [2 x i8] c"\0A\00", align 1 +@77 = private unnamed_addr constant [11 x i8] c"Well done!\00", align 1 +@78 = private unnamed_addr constant [5 x i8] c"%s%s\00", align 1 +@79 = private unnamed_addr constant [2 x i8] c" \00", align 1 +@80 = private unnamed_addr constant [2 x i8] c"\0A\00", align 1 +@81 = private unnamed_addr constant [9 x i8] c"Not bad!\00", align 1 +@82 = private unnamed_addr constant [5 x i8] c"%s%s\00", align 1 +@83 = private unnamed_addr constant [2 x i8] c" \00", align 1 +@84 = private unnamed_addr constant [2 x i8] c"\0A\00", align 1 +@85 = private unnamed_addr constant [12 x i8] c"You passed!\00", align 1 +@86 = private unnamed_addr constant [5 x i8] c"%s%s\00", align 1 +@87 = private unnamed_addr constant [2 x i8] c" \00", align 1 +@88 = private unnamed_addr constant [2 x i8] c"\0A\00", align 1 +@89 = private unnamed_addr constant [18 x i8] c"Better try again!\00", align 1 +@90 = private unnamed_addr constant [5 x i8] c"%s%s\00", align 1 +@91 = private unnamed_addr constant [2 x i8] c" \00", align 1 +@92 = private unnamed_addr constant [2 x i8] c"\0A\00", align 1 +@93 = private unnamed_addr constant [14 x i8] c"Invalid marks\00", align 1 +@94 = private unnamed_addr constant [5 x i8] c"%s%s\00", align 1 +@95 = private unnamed_addr constant [2 x i8] c" \00", align 1 +@96 = private unnamed_addr constant [2 x i8] c"\0A\00", align 1 +@97 = private unnamed_addr constant [16 x i8] c"Your marks are \00", align 1 +@98 = private unnamed_addr constant [9 x i8] c"%s%s%d%s\00", align 1 define i32 @main(i32 %0, i8** %1) { .entry: @@ -211,13 +208,13 @@ ifcont14: ; preds = %ifcont13, %then1 ifcont15: ; preds = %ifcont14, %then %34 = load i32, i32* %marks, align 4 - call void (i8*, ...) @_lfortran_printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @32, i32 0, i32 0), i8* getelementptr inbounds ([16 x i8], [16 x i8]* @30, i32 0, i32 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @31, i32 0, i32 0), i32 %34, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @29, i32 0, i32 0)) + call void (i8*, ...) @_lfortran_printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @31, i32 0, i32 0), i8* getelementptr inbounds ([16 x i8], [16 x i8]* @30, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @28, i32 0, i32 0), i32 %34, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @29, i32 0, i32 0)) %35 = load i32, i32* %out, align 4 %36 = icmp ne i32 %35, 1 br i1 %36, label %then16, label %else17 then16: ; preds = %ifcont15 - call void (i8*, ...) @_lcompilers_print_error(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @35, i32 0, i32 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @33, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @34, i32 0, i32 0)) + call void (i8*, ...) @_lcompilers_print_error(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @34, i32 0, i32 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @32, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @33, i32 0, i32 0)) call void @exit(i32 1) br label %ifcont18 @@ -234,7 +231,7 @@ ifcont18: ; preds = %else17, %then16 br i1 %42, label %then19, label %else20 then19: ; preds = %ifcont18 - call void (i8*, ...) @_lfortran_printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @39, i32 0, i32 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @38, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @37, i32 0, i32 0)) + call void (i8*, ...) @_lfortran_printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @38, i32 0, i32 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @37, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @36, i32 0, i32 0)) br label %ifcont36 else20: ; preds = %ifcont18 @@ -247,7 +244,7 @@ else20: ; preds = %ifcont18 br i1 %48, label %then21, label %else22 then21: ; preds = %else20 - call void (i8*, ...) @_lfortran_printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @43, i32 0, i32 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @42, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @41, i32 0, i32 0)) + call void (i8*, ...) @_lfortran_printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @42, i32 0, i32 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @41, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @40, i32 0, i32 0)) br label %ifcont35 else22: ; preds = %else20 @@ -260,7 +257,7 @@ else22: ; preds = %else20 br i1 %54, label %then23, label %else24 then23: ; preds = %else22 - call void (i8*, ...) @_lfortran_printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @47, i32 0, i32 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @46, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @45, i32 0, i32 0)) + call void (i8*, ...) @_lfortran_printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @46, i32 0, i32 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @45, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @44, i32 0, i32 0)) br label %ifcont34 else24: ; preds = %else22 @@ -273,7 +270,7 @@ else24: ; preds = %else22 br i1 %60, label %then25, label %else26 then25: ; preds = %else24 - call void (i8*, ...) @_lfortran_printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @51, i32 0, i32 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @50, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @49, i32 0, i32 0)) + call void (i8*, ...) @_lfortran_printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @50, i32 0, i32 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @49, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @48, i32 0, i32 0)) br label %ifcont33 else26: ; preds = %else24 @@ -286,7 +283,7 @@ else26: ; preds = %else24 br i1 %66, label %then27, label %else28 then27: ; preds = %else26 - call void (i8*, ...) @_lfortran_printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @55, i32 0, i32 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @54, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @53, i32 0, i32 0)) + call void (i8*, ...) @_lfortran_printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @54, i32 0, i32 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @53, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @52, i32 0, i32 0)) br label %ifcont32 else28: ; preds = %else26 @@ -295,11 +292,11 @@ else28: ; preds = %else26 br i1 %68, label %then29, label %else30 then29: ; preds = %else28 - call void (i8*, ...) @_lfortran_printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @59, i32 0, i32 0), i8* getelementptr inbounds ([18 x i8], [18 x i8]* @58, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @57, i32 0, i32 0)) + call void (i8*, ...) @_lfortran_printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @58, i32 0, i32 0), i8* getelementptr inbounds ([18 x i8], [18 x i8]* @57, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @56, i32 0, i32 0)) br label %ifcont31 else30: ; preds = %else28 - call void (i8*, ...) @_lfortran_printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @63, i32 0, i32 0), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @62, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @61, i32 0, i32 0)) + call void (i8*, ...) @_lfortran_printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @62, i32 0, i32 0), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @61, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @60, i32 0, i32 0)) br label %ifcont31 ifcont31: ; preds = %else30, %then29 @@ -319,7 +316,7 @@ ifcont35: ; preds = %ifcont34, %then21 ifcont36: ; preds = %ifcont35, %then19 %69 = load i32, i32* %marks, align 4 - call void (i8*, ...) @_lfortran_printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @68, i32 0, i32 0), i8* getelementptr inbounds ([16 x i8], [16 x i8]* @66, i32 0, i32 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @67, i32 0, i32 0), i32 %69, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @65, i32 0, i32 0)) + call void (i8*, ...) @_lfortran_printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @66, i32 0, i32 0), i8* getelementptr inbounds ([16 x i8], [16 x i8]* @65, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @63, i32 0, i32 0), i32 %69, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @64, i32 0, i32 0)) %70 = load i32, i32* %marks, align 4 %71 = icmp sle i32 91, %70 %72 = load i32, i32* %marks, align 4 @@ -329,7 +326,7 @@ ifcont36: ; preds = %ifcont35, %then19 br i1 %75, label %then37, label %else38 then37: ; preds = %ifcont36 - call void (i8*, ...) @_lfortran_printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @72, i32 0, i32 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @71, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @70, i32 0, i32 0)) + call void (i8*, ...) @_lfortran_printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @70, i32 0, i32 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @69, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @68, i32 0, i32 0)) br label %ifcont54 else38: ; preds = %ifcont36 @@ -342,7 +339,7 @@ else38: ; preds = %ifcont36 br i1 %81, label %then39, label %else40 then39: ; preds = %else38 - call void (i8*, ...) @_lfortran_printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @76, i32 0, i32 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @75, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @74, i32 0, i32 0)) + call void (i8*, ...) @_lfortran_printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @74, i32 0, i32 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @73, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @72, i32 0, i32 0)) br label %ifcont53 else40: ; preds = %else38 @@ -355,7 +352,7 @@ else40: ; preds = %else38 br i1 %87, label %then41, label %else42 then41: ; preds = %else40 - call void (i8*, ...) @_lfortran_printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @80, i32 0, i32 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @79, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @78, i32 0, i32 0)) + call void (i8*, ...) @_lfortran_printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @78, i32 0, i32 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @77, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @76, i32 0, i32 0)) br label %ifcont52 else42: ; preds = %else40 @@ -368,7 +365,7 @@ else42: ; preds = %else40 br i1 %93, label %then43, label %else44 then43: ; preds = %else42 - call void (i8*, ...) @_lfortran_printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @84, i32 0, i32 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @83, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @82, i32 0, i32 0)) + call void (i8*, ...) @_lfortran_printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @82, i32 0, i32 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @81, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @80, i32 0, i32 0)) br label %ifcont51 else44: ; preds = %else42 @@ -381,7 +378,7 @@ else44: ; preds = %else42 br i1 %99, label %then45, label %else46 then45: ; preds = %else44 - call void (i8*, ...) @_lfortran_printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @88, i32 0, i32 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @87, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @86, i32 0, i32 0)) + call void (i8*, ...) @_lfortran_printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @86, i32 0, i32 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @85, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @84, i32 0, i32 0)) br label %ifcont50 else46: ; preds = %else44 @@ -390,11 +387,11 @@ else46: ; preds = %else44 br i1 %101, label %then47, label %else48 then47: ; preds = %else46 - call void (i8*, ...) @_lfortran_printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @92, i32 0, i32 0), i8* getelementptr inbounds ([18 x i8], [18 x i8]* @91, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @90, i32 0, i32 0)) + call void (i8*, ...) @_lfortran_printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @90, i32 0, i32 0), i8* getelementptr inbounds ([18 x i8], [18 x i8]* @89, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @88, i32 0, i32 0)) br label %ifcont49 else48: ; preds = %else46 - call void (i8*, ...) @_lfortran_printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @96, i32 0, i32 0), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @95, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @94, i32 0, i32 0)) + call void (i8*, ...) @_lfortran_printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @94, i32 0, i32 0), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @93, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @92, i32 0, i32 0)) br label %ifcont49 ifcont49: ; preds = %else48, %then47 @@ -414,7 +411,7 @@ ifcont53: ; preds = %ifcont52, %then39 ifcont54: ; preds = %ifcont53, %then37 %102 = load i32, i32* %marks, align 4 - call void (i8*, ...) @_lfortran_printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @101, i32 0, i32 0), i8* getelementptr inbounds ([16 x i8], [16 x i8]* @99, i32 0, i32 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @100, i32 0, i32 0), i32 %102, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @98, i32 0, i32 0)) + call void (i8*, ...) @_lfortran_printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @98, i32 0, i32 0), i8* getelementptr inbounds ([16 x i8], [16 x i8]* @97, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @95, i32 0, i32 0), i32 %102, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @96, i32 0, i32 0)) ret i32 0 } diff --git a/tests/reference/llvm-case_03-c3a5078.json b/tests/reference/llvm-case_03-c3a5078.json index bb87b80708..838ea79581 100644 --- a/tests/reference/llvm-case_03-c3a5078.json +++ b/tests/reference/llvm-case_03-c3a5078.json @@ -6,7 +6,7 @@ "outfile": null, "outfile_hash": null, "stdout": "llvm-case_03-c3a5078.stdout", - "stdout_hash": "9c22d66fad2002f0dd4686f029add7ff88be4b7e4dcad43ca66098ef", + "stdout_hash": "c08572e1a186427a4df936af5aba218b004c0cdb22063f1c666b9676", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/llvm-case_03-c3a5078.stdout b/tests/reference/llvm-case_03-c3a5078.stdout index c90998fb25..4fc91fced6 100644 --- a/tests/reference/llvm-case_03-c3a5078.stdout +++ b/tests/reference/llvm-case_03-c3a5078.stdout @@ -16,25 +16,23 @@ source_filename = "LFortran" @12 = private unnamed_addr constant [2 x i8] c" \00", align 1 @13 = private unnamed_addr constant [2 x i8] c"\0A\00", align 1 @14 = private unnamed_addr constant [16 x i8] c"Your marks are \00", align 1 -@15 = private unnamed_addr constant [1 x i8] zeroinitializer, align 1 -@16 = private unnamed_addr constant [9 x i8] c"%s%s%d%s\00", align 1 -@17 = private unnamed_addr constant [2 x i8] c" \00", align 1 -@18 = private unnamed_addr constant [2 x i8] c"\0A\00", align 1 -@19 = private unnamed_addr constant [6 x i8] c"Pass!\00", align 1 -@20 = private unnamed_addr constant [5 x i8] c"%s%s\00", align 1 -@21 = private unnamed_addr constant [2 x i8] c" \00", align 1 -@22 = private unnamed_addr constant [2 x i8] c"\0A\00", align 1 -@23 = private unnamed_addr constant [8 x i8] c"Failed!\00", align 1 -@24 = private unnamed_addr constant [5 x i8] c"%s%s\00", align 1 -@25 = private unnamed_addr constant [2 x i8] c" \00", align 1 -@26 = private unnamed_addr constant [2 x i8] c"\0A\00", align 1 -@27 = private unnamed_addr constant [14 x i8] c"Invalid marks\00", align 1 -@28 = private unnamed_addr constant [5 x i8] c"%s%s\00", align 1 -@29 = private unnamed_addr constant [2 x i8] c" \00", align 1 -@30 = private unnamed_addr constant [2 x i8] c"\0A\00", align 1 -@31 = private unnamed_addr constant [16 x i8] c"Your marks are \00", align 1 -@32 = private unnamed_addr constant [1 x i8] zeroinitializer, align 1 -@33 = private unnamed_addr constant [9 x i8] c"%s%s%d%s\00", align 1 +@15 = private unnamed_addr constant [9 x i8] c"%s%s%d%s\00", align 1 +@16 = private unnamed_addr constant [2 x i8] c" \00", align 1 +@17 = private unnamed_addr constant [2 x i8] c"\0A\00", align 1 +@18 = private unnamed_addr constant [6 x i8] c"Pass!\00", align 1 +@19 = private unnamed_addr constant [5 x i8] c"%s%s\00", align 1 +@20 = private unnamed_addr constant [2 x i8] c" \00", align 1 +@21 = private unnamed_addr constant [2 x i8] c"\0A\00", align 1 +@22 = private unnamed_addr constant [8 x i8] c"Failed!\00", align 1 +@23 = private unnamed_addr constant [5 x i8] c"%s%s\00", align 1 +@24 = private unnamed_addr constant [2 x i8] c" \00", align 1 +@25 = private unnamed_addr constant [2 x i8] c"\0A\00", align 1 +@26 = private unnamed_addr constant [14 x i8] c"Invalid marks\00", align 1 +@27 = private unnamed_addr constant [5 x i8] c"%s%s\00", align 1 +@28 = private unnamed_addr constant [2 x i8] c" \00", align 1 +@29 = private unnamed_addr constant [2 x i8] c"\0A\00", align 1 +@30 = private unnamed_addr constant [16 x i8] c"Your marks are \00", align 1 +@31 = private unnamed_addr constant [9 x i8] c"%s%s%d%s\00", align 1 define i32 @main(i32 %0, i8** %1) { .entry: @@ -71,14 +69,14 @@ ifcont: ; preds = %else2, %then1 ifcont3: ; preds = %ifcont, %then %6 = load i32, i32* %marks, align 4 - call void (i8*, ...) @_lfortran_printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @16, i32 0, i32 0), i8* getelementptr inbounds ([16 x i8], [16 x i8]* @14, i32 0, i32 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @15, i32 0, i32 0), i32 %6, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @13, i32 0, i32 0)) + call void (i8*, ...) @_lfortran_printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @15, i32 0, i32 0), i8* getelementptr inbounds ([16 x i8], [16 x i8]* @14, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @12, i32 0, i32 0), i32 %6, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @13, i32 0, i32 0)) store i32 -1, i32* %marks, align 4 %7 = load i32, i32* %marks, align 4 %8 = icmp sle i32 42, %7 br i1 %8, label %then4, label %else5 then4: ; preds = %ifcont3 - call void (i8*, ...) @_lfortran_printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @20, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @19, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @18, i32 0, i32 0)) + call void (i8*, ...) @_lfortran_printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @19, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @18, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @17, i32 0, i32 0)) br label %ifcont9 else5: ; preds = %ifcont3 @@ -91,11 +89,11 @@ else5: ; preds = %ifcont3 br i1 %14, label %then6, label %else7 then6: ; preds = %else5 - call void (i8*, ...) @_lfortran_printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @24, i32 0, i32 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @23, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @22, i32 0, i32 0)) + call void (i8*, ...) @_lfortran_printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @23, i32 0, i32 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @22, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @21, i32 0, i32 0)) br label %ifcont8 else7: ; preds = %else5 - call void (i8*, ...) @_lfortran_printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @28, i32 0, i32 0), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @27, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @26, i32 0, i32 0)) + call void (i8*, ...) @_lfortran_printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @27, i32 0, i32 0), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @26, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @25, i32 0, i32 0)) br label %ifcont8 ifcont8: ; preds = %else7, %then6 @@ -103,7 +101,7 @@ ifcont8: ; preds = %else7, %then6 ifcont9: ; preds = %ifcont8, %then4 %15 = load i32, i32* %marks, align 4 - call void (i8*, ...) @_lfortran_printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @33, i32 0, i32 0), i8* getelementptr inbounds ([16 x i8], [16 x i8]* @31, i32 0, i32 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @32, i32 0, i32 0), i32 %15, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @30, i32 0, i32 0)) + call void (i8*, ...) @_lfortran_printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @31, i32 0, i32 0), i8* getelementptr inbounds ([16 x i8], [16 x i8]* @30, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @28, i32 0, i32 0), i32 %15, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @29, i32 0, i32 0)) ret i32 0 } diff --git a/tests/reference/llvm-class_01-82031c0.json b/tests/reference/llvm-class_01-82031c0.json index bc4fac3d11..0a30bd9339 100644 --- a/tests/reference/llvm-class_01-82031c0.json +++ b/tests/reference/llvm-class_01-82031c0.json @@ -6,7 +6,7 @@ "outfile": null, "outfile_hash": null, "stdout": "llvm-class_01-82031c0.stdout", - "stdout_hash": "286628398e23e12ecb5e26bffa97a193ceddb5880293ca62094a1bb2", + "stdout_hash": "b3216bab5752c3a579f340405f3ec321141fb3dfffc5f671b3d98427", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/llvm-class_01-82031c0.stdout b/tests/reference/llvm-class_01-82031c0.stdout index 8b829d9899..7df0966ce3 100644 --- a/tests/reference/llvm-class_01-82031c0.stdout +++ b/tests/reference/llvm-class_01-82031c0.stdout @@ -9,9 +9,8 @@ source_filename = "LFortran" @0 = private unnamed_addr constant [2 x i8] c" \00", align 1 @1 = private unnamed_addr constant [2 x i8] c"\0A\00", align 1 @2 = private unnamed_addr constant [13 x i8] c"Circle: r = \00", align 1 -@3 = private unnamed_addr constant [1 x i8] zeroinitializer, align 1 -@4 = private unnamed_addr constant [9 x i8] c" area = \00", align 1 -@5 = private unnamed_addr constant [25 x i8] c"%s%s%13.8e%s%s%s%13.8e%s\00", align 1 +@3 = private unnamed_addr constant [9 x i8] c" area = \00", align 1 +@4 = private unnamed_addr constant [25 x i8] c"%s%s%13.8e%s%s%s%13.8e%s\00", align 1 define float @__module_class_circle1_circle_area(%circle_polymorphic* %this) { .entry: @@ -49,7 +48,7 @@ define void @__module_class_circle1_circle_print(%circle_polymorphic* %this) { %7 = fpext float %6 to double %8 = load float, float* %area, align 4 %9 = fpext float %8 to double - call void (i8*, ...) @_lfortran_printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @5, i32 0, i32 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @2, i32 0, i32 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @3, i32 0, i32 0), double %7, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @0, i32 0, i32 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @4, i32 0, i32 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @3, i32 0, i32 0), double %9, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @1, i32 0, i32 0)) + call void (i8*, ...) @_lfortran_printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @4, i32 0, i32 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @2, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @0, i32 0, i32 0), double %7, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @0, i32 0, i32 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @3, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @0, i32 0, i32 0), double %9, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @1, i32 0, i32 0)) br label %return return: ; preds = %.entry diff --git a/tests/reference/llvm-class_02-82c2f9c.json b/tests/reference/llvm-class_02-82c2f9c.json index fbdd17464a..3a7d002259 100644 --- a/tests/reference/llvm-class_02-82c2f9c.json +++ b/tests/reference/llvm-class_02-82c2f9c.json @@ -6,7 +6,7 @@ "outfile": null, "outfile_hash": null, "stdout": "llvm-class_02-82c2f9c.stdout", - "stdout_hash": "dda46f44a847d917b80ff4d0525e53658486ac1ea588a7618652aac0", + "stdout_hash": "95a82070b785d2d128c57cfd6fba89d3358419de16d868b7b60912f8", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/llvm-class_02-82c2f9c.stdout b/tests/reference/llvm-class_02-82c2f9c.stdout index cf5fdece5d..0cf211f799 100644 --- a/tests/reference/llvm-class_02-82c2f9c.stdout +++ b/tests/reference/llvm-class_02-82c2f9c.stdout @@ -9,9 +9,8 @@ source_filename = "LFortran" @0 = private unnamed_addr constant [2 x i8] c" \00", align 1 @1 = private unnamed_addr constant [2 x i8] c"\0A\00", align 1 @2 = private unnamed_addr constant [13 x i8] c"Circle: r = \00", align 1 -@3 = private unnamed_addr constant [1 x i8] zeroinitializer, align 1 -@4 = private unnamed_addr constant [9 x i8] c" area = \00", align 1 -@5 = private unnamed_addr constant [25 x i8] c"%s%s%13.8e%s%s%s%13.8e%s\00", align 1 +@3 = private unnamed_addr constant [9 x i8] c" area = \00", align 1 +@4 = private unnamed_addr constant [25 x i8] c"%s%s%13.8e%s%s%s%13.8e%s\00", align 1 define float @__module_class_circle2_circle_area(%circle_polymorphic* %this) { .entry: @@ -49,7 +48,7 @@ define void @__module_class_circle2_circle_print(%circle_polymorphic* %this) { %7 = fpext float %6 to double %8 = load float, float* %area, align 4 %9 = fpext float %8 to double - call void (i8*, ...) @_lfortran_printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @5, i32 0, i32 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @2, i32 0, i32 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @3, i32 0, i32 0), double %7, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @0, i32 0, i32 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @4, i32 0, i32 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @3, i32 0, i32 0), double %9, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @1, i32 0, i32 0)) + call void (i8*, ...) @_lfortran_printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @4, i32 0, i32 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @2, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @0, i32 0, i32 0), double %7, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @0, i32 0, i32 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @3, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @0, i32 0, i32 0), double %9, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @1, i32 0, i32 0)) br label %return return: ; preds = %.entry diff --git a/tests/reference/llvm-class_03-d370451.json b/tests/reference/llvm-class_03-d370451.json index 10b5bfedf0..1426f234f1 100644 --- a/tests/reference/llvm-class_03-d370451.json +++ b/tests/reference/llvm-class_03-d370451.json @@ -6,7 +6,7 @@ "outfile": null, "outfile_hash": null, "stdout": "llvm-class_03-d370451.stdout", - "stdout_hash": "4a6660b70e7e40b6fe0887a8608e5a1e5bc5b68ec1ba4d5b5129ead7", + "stdout_hash": "21ca11673a65dbc17ec8fc692d947941dfc13844b2e7f156dffdd3dd", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/llvm-class_03-d370451.stdout b/tests/reference/llvm-class_03-d370451.stdout index 4bcaa73dd5..19c3aa9ad1 100644 --- a/tests/reference/llvm-class_03-d370451.stdout +++ b/tests/reference/llvm-class_03-d370451.stdout @@ -68,7 +68,7 @@ define i32 @main(i32 %0, i8** %1) { %32 = load i32, i32* %31, align 4 %33 = getelementptr %person, %person* %jack, i32 0, i32 3 %34 = load i8*, i8** %33, align 8 - call void (i8*, ...) @_lfortran_printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @10, i32 0, i32 0), i8* %28, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @9, i32 0, i32 0), i8* %30, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @9, i32 0, i32 0), i32 %32, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @7, i32 0, i32 0), i8* %34, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @8, i32 0, i32 0)) + call void (i8*, ...) @_lfortran_printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @10, i32 0, i32 0), i8* %28, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @9, i32 0, i32 0), i8* %30, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @7, i32 0, i32 0), i32 %32, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @7, i32 0, i32 0), i8* %34, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @8, i32 0, i32 0)) %35 = getelementptr %employee, %employee* %jill, i32 0, i32 0 %36 = getelementptr %person, %person* %35, i32 0, i32 0 %37 = load i8*, i8** %36, align 8 @@ -85,7 +85,7 @@ define i32 @main(i32 %0, i8** %1) { %48 = load i8*, i8** %47, align 8 %49 = getelementptr %employee, %employee* %jill, i32 0, i32 1 %50 = load i32, i32* %49, align 4 - call void (i8*, ...) @_lfortran_printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @14, i32 0, i32 0), i8* %37, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @13, i32 0, i32 0), i8* %40, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @13, i32 0, i32 0), i32 %43, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @11, i32 0, i32 0), i8* %46, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @13, i32 0, i32 0), i8* %48, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @13, i32 0, i32 0), i32 %50, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @12, i32 0, i32 0)) + call void (i8*, ...) @_lfortran_printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @14, i32 0, i32 0), i8* %37, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @13, i32 0, i32 0), i8* %40, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @11, i32 0, i32 0), i32 %43, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @11, i32 0, i32 0), i8* %46, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @13, i32 0, i32 0), i8* %48, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @11, i32 0, i32 0), i32 %50, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @12, i32 0, i32 0)) ret i32 0 } diff --git a/tests/reference/llvm-modules_11-a28ab77.json b/tests/reference/llvm-modules_11-a28ab77.json index edf245b8d1..2447d80a39 100644 --- a/tests/reference/llvm-modules_11-a28ab77.json +++ b/tests/reference/llvm-modules_11-a28ab77.json @@ -6,7 +6,7 @@ "outfile": null, "outfile_hash": null, "stdout": "llvm-modules_11-a28ab77.stdout", - "stdout_hash": "30d4fcb83872ea5f395ae00f68eb5be44a0a2f47d8325c1122df68e2", + "stdout_hash": "7f116a10767b55d93ba4507a072e7dffce616aa9a69df7b5f14ff57b", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/llvm-modules_11-a28ab77.stdout b/tests/reference/llvm-modules_11-a28ab77.stdout index 8467b8e1bc..2ed94ff4f3 100644 --- a/tests/reference/llvm-modules_11-a28ab77.stdout +++ b/tests/reference/llvm-modules_11-a28ab77.stdout @@ -6,18 +6,16 @@ source_filename = "LFortran" @0 = private unnamed_addr constant [2 x i8] c" \00", align 1 @1 = private unnamed_addr constant [2 x i8] c"\0A\00", align 1 @2 = private unnamed_addr constant [5 x i8] c"i = \00", align 1 -@3 = private unnamed_addr constant [1 x i8] zeroinitializer, align 1 -@4 = private unnamed_addr constant [9 x i8] c"%s%s%d%s\00", align 1 -@5 = private unnamed_addr constant [2 x i8] c" \00", align 1 -@6 = private unnamed_addr constant [2 x i8] c"\0A\00", align 1 -@7 = private unnamed_addr constant [5 x i8] c"j = \00", align 1 -@8 = private unnamed_addr constant [1 x i8] zeroinitializer, align 1 -@9 = private unnamed_addr constant [9 x i8] c"%s%s%d%s\00", align 1 +@3 = private unnamed_addr constant [9 x i8] c"%s%s%d%s\00", align 1 +@4 = private unnamed_addr constant [2 x i8] c" \00", align 1 +@5 = private unnamed_addr constant [2 x i8] c"\0A\00", align 1 +@6 = private unnamed_addr constant [5 x i8] c"j = \00", align 1 +@7 = private unnamed_addr constant [9 x i8] c"%s%s%d%s\00", align 1 define void @__module_modules_11_module11_access_internally() { .entry: %0 = load i32, i32* @i, align 4 - call void (i8*, ...) @_lfortran_printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @4, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @2, i32 0, i32 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @3, i32 0, i32 0), i32 %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @1, i32 0, i32 0)) + call void (i8*, ...) @_lfortran_printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @3, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @2, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @0, i32 0, i32 0), i32 %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @1, i32 0, i32 0)) br label %return return: ; preds = %.entry @@ -30,7 +28,7 @@ define i32 @main(i32 %0, i8** %1) { .entry: call void @_lpython_set_argv(i32 %0, i8** %1) %2 = load i32, i32* @j, align 4 - call void (i8*, ...) @_lfortran_printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @9, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @7, i32 0, i32 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @8, i32 0, i32 0), i32 %2, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @6, i32 0, i32 0)) + call void (i8*, ...) @_lfortran_printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @7, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @6, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @4, i32 0, i32 0), i32 %2, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @5, i32 0, i32 0)) call void @__module_modules_11_module11_access_internally() ret i32 0 } diff --git a/tests/reference/llvm-operator_overloading_01-33c47db.json b/tests/reference/llvm-operator_overloading_01-33c47db.json index d07ed6bc13..0bc8eab088 100644 --- a/tests/reference/llvm-operator_overloading_01-33c47db.json +++ b/tests/reference/llvm-operator_overloading_01-33c47db.json @@ -6,7 +6,7 @@ "outfile": null, "outfile_hash": null, "stdout": "llvm-operator_overloading_01-33c47db.stdout", - "stdout_hash": "253a63d627caf6ef7f0ddc1cfffcab7ae6ec1ac4e18015282c53ebf0", + "stdout_hash": "bbdd9b230c6434f0edd4daeeb9cbf711028a1a4e848c563985cd48e9", "stderr": "llvm-operator_overloading_01-33c47db.stderr", "stderr_hash": "bc887b577bc8ccfc15f212c070a67ee8c67af8d343abdd0132e6b6fb", "returncode": 0 diff --git a/tests/reference/llvm-operator_overloading_01-33c47db.stdout b/tests/reference/llvm-operator_overloading_01-33c47db.stdout index 3efcbb3d31..c6df430b91 100644 --- a/tests/reference/llvm-operator_overloading_01-33c47db.stdout +++ b/tests/reference/llvm-operator_overloading_01-33c47db.stdout @@ -4,51 +4,43 @@ source_filename = "LFortran" @0 = private unnamed_addr constant [2 x i8] c" \00", align 1 @1 = private unnamed_addr constant [2 x i8] c"\0A\00", align 1 @2 = private unnamed_addr constant [5 x i8] c"T*T:\00", align 1 -@3 = private unnamed_addr constant [1 x i8] zeroinitializer, align 1 -@4 = private unnamed_addr constant [6 x i8] c"False\00", align 1 -@5 = private unnamed_addr constant [5 x i8] c"True\00", align 1 -@6 = private unnamed_addr constant [9 x i8] c"%s%s%s%s\00", align 1 -@7 = private unnamed_addr constant [2 x i8] c" \00", align 1 -@8 = private unnamed_addr constant [2 x i8] c"\0A\00", align 1 -@9 = private unnamed_addr constant [5 x i8] c"T*F:\00", align 1 -@10 = private unnamed_addr constant [1 x i8] zeroinitializer, align 1 -@11 = private unnamed_addr constant [6 x i8] c"False\00", align 1 -@12 = private unnamed_addr constant [5 x i8] c"True\00", align 1 -@13 = private unnamed_addr constant [9 x i8] c"%s%s%s%s\00", align 1 -@14 = private unnamed_addr constant [2 x i8] c" \00", align 1 -@15 = private unnamed_addr constant [2 x i8] c"\0A\00", align 1 -@16 = private unnamed_addr constant [5 x i8] c"F*T:\00", align 1 -@17 = private unnamed_addr constant [1 x i8] zeroinitializer, align 1 -@18 = private unnamed_addr constant [6 x i8] c"False\00", align 1 -@19 = private unnamed_addr constant [5 x i8] c"True\00", align 1 -@20 = private unnamed_addr constant [9 x i8] c"%s%s%s%s\00", align 1 -@21 = private unnamed_addr constant [2 x i8] c" \00", align 1 -@22 = private unnamed_addr constant [2 x i8] c"\0A\00", align 1 -@23 = private unnamed_addr constant [5 x i8] c"F*F:\00", align 1 -@24 = private unnamed_addr constant [1 x i8] zeroinitializer, align 1 -@25 = private unnamed_addr constant [6 x i8] c"False\00", align 1 -@26 = private unnamed_addr constant [5 x i8] c"True\00", align 1 -@27 = private unnamed_addr constant [9 x i8] c"%s%s%s%s\00", align 1 +@3 = private unnamed_addr constant [6 x i8] c"False\00", align 1 +@4 = private unnamed_addr constant [5 x i8] c"True\00", align 1 +@5 = private unnamed_addr constant [9 x i8] c"%s%s%s%s\00", align 1 +@6 = private unnamed_addr constant [2 x i8] c" \00", align 1 +@7 = private unnamed_addr constant [2 x i8] c"\0A\00", align 1 +@8 = private unnamed_addr constant [5 x i8] c"T*F:\00", align 1 +@9 = private unnamed_addr constant [6 x i8] c"False\00", align 1 +@10 = private unnamed_addr constant [5 x i8] c"True\00", align 1 +@11 = private unnamed_addr constant [9 x i8] c"%s%s%s%s\00", align 1 +@12 = private unnamed_addr constant [2 x i8] c" \00", align 1 +@13 = private unnamed_addr constant [2 x i8] c"\0A\00", align 1 +@14 = private unnamed_addr constant [5 x i8] c"F*T:\00", align 1 +@15 = private unnamed_addr constant [6 x i8] c"False\00", align 1 +@16 = private unnamed_addr constant [5 x i8] c"True\00", align 1 +@17 = private unnamed_addr constant [9 x i8] c"%s%s%s%s\00", align 1 +@18 = private unnamed_addr constant [2 x i8] c" \00", align 1 +@19 = private unnamed_addr constant [2 x i8] c"\0A\00", align 1 +@20 = private unnamed_addr constant [5 x i8] c"F*F:\00", align 1 +@21 = private unnamed_addr constant [6 x i8] c"False\00", align 1 +@22 = private unnamed_addr constant [5 x i8] c"True\00", align 1 +@23 = private unnamed_addr constant [9 x i8] c"%s%s%s%s\00", align 1 +@24 = private unnamed_addr constant [2 x i8] c" \00", align 1 +@25 = private unnamed_addr constant [2 x i8] c"\0A\00", align 1 +@26 = private unnamed_addr constant [5 x i8] c"T+T:\00", align 1 +@27 = private unnamed_addr constant [9 x i8] c"%s%s%d%s\00", align 1 @28 = private unnamed_addr constant [2 x i8] c" \00", align 1 @29 = private unnamed_addr constant [2 x i8] c"\0A\00", align 1 -@30 = private unnamed_addr constant [5 x i8] c"T+T:\00", align 1 -@31 = private unnamed_addr constant [1 x i8] zeroinitializer, align 1 -@32 = private unnamed_addr constant [9 x i8] c"%s%s%d%s\00", align 1 -@33 = private unnamed_addr constant [2 x i8] c" \00", align 1 -@34 = private unnamed_addr constant [2 x i8] c"\0A\00", align 1 -@35 = private unnamed_addr constant [5 x i8] c"T+F:\00", align 1 -@36 = private unnamed_addr constant [1 x i8] zeroinitializer, align 1 -@37 = private unnamed_addr constant [9 x i8] c"%s%s%d%s\00", align 1 -@38 = private unnamed_addr constant [2 x i8] c" \00", align 1 -@39 = private unnamed_addr constant [2 x i8] c"\0A\00", align 1 -@40 = private unnamed_addr constant [5 x i8] c"F+T:\00", align 1 -@41 = private unnamed_addr constant [1 x i8] zeroinitializer, align 1 -@42 = private unnamed_addr constant [9 x i8] c"%s%s%d%s\00", align 1 -@43 = private unnamed_addr constant [2 x i8] c" \00", align 1 -@44 = private unnamed_addr constant [2 x i8] c"\0A\00", align 1 -@45 = private unnamed_addr constant [5 x i8] c"F+F:\00", align 1 -@46 = private unnamed_addr constant [1 x i8] zeroinitializer, align 1 -@47 = private unnamed_addr constant [9 x i8] c"%s%s%d%s\00", align 1 +@30 = private unnamed_addr constant [5 x i8] c"T+F:\00", align 1 +@31 = private unnamed_addr constant [9 x i8] c"%s%s%d%s\00", align 1 +@32 = private unnamed_addr constant [2 x i8] c" \00", align 1 +@33 = private unnamed_addr constant [2 x i8] c"\0A\00", align 1 +@34 = private unnamed_addr constant [5 x i8] c"F+T:\00", align 1 +@35 = private unnamed_addr constant [9 x i8] c"%s%s%d%s\00", align 1 +@36 = private unnamed_addr constant [2 x i8] c" \00", align 1 +@37 = private unnamed_addr constant [2 x i8] c"\0A\00", align 1 +@38 = private unnamed_addr constant [5 x i8] c"F+F:\00", align 1 +@39 = private unnamed_addr constant [9 x i8] c"%s%s%d%s\00", align 1 define i32 @__module_operator_overloading_01_overload_asterisk_m_bin_add(i1* %log1, i1* %log2) { .entry: @@ -115,28 +107,28 @@ define i32 @main(i32 %0, i8** %1) { store i1 true, i1* %t, align 1 %2 = call i1 @__module_operator_overloading_01_overload_asterisk_m_logical_and(i1* %t, i1* %t) %3 = icmp eq i1 %2, false - %4 = select i1 %3, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @4, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @5, i32 0, i32 0) - call void (i8*, ...) @_lfortran_printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @6, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @2, i32 0, i32 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @3, i32 0, i32 0), i8* %4, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @1, i32 0, i32 0)) + %4 = select i1 %3, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @3, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @4, i32 0, i32 0) + call void (i8*, ...) @_lfortran_printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @5, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @2, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @0, i32 0, i32 0), i8* %4, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @1, i32 0, i32 0)) %5 = call i1 @__module_operator_overloading_01_overload_asterisk_m_logical_and(i1* %t, i1* %f) %6 = icmp eq i1 %5, false - %7 = select i1 %6, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @11, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @12, i32 0, i32 0) - call void (i8*, ...) @_lfortran_printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @13, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @9, i32 0, i32 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @10, i32 0, i32 0), i8* %7, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @8, i32 0, i32 0)) + %7 = select i1 %6, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @9, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @10, i32 0, i32 0) + call void (i8*, ...) @_lfortran_printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @11, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @8, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @6, i32 0, i32 0), i8* %7, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @7, i32 0, i32 0)) %8 = call i1 @__module_operator_overloading_01_overload_asterisk_m_logical_and(i1* %f, i1* %t) %9 = icmp eq i1 %8, false - %10 = select i1 %9, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @18, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @19, i32 0, i32 0) - call void (i8*, ...) @_lfortran_printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @20, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @16, i32 0, i32 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @17, i32 0, i32 0), i8* %10, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @15, i32 0, i32 0)) + %10 = select i1 %9, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @15, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @16, i32 0, i32 0) + call void (i8*, ...) @_lfortran_printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @17, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @14, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @12, i32 0, i32 0), i8* %10, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @13, i32 0, i32 0)) %11 = call i1 @__module_operator_overloading_01_overload_asterisk_m_logical_and(i1* %f, i1* %f) %12 = icmp eq i1 %11, false - %13 = select i1 %12, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @25, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @26, i32 0, i32 0) - call void (i8*, ...) @_lfortran_printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @27, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @23, i32 0, i32 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @24, i32 0, i32 0), i8* %13, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @22, i32 0, i32 0)) + %13 = select i1 %12, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @21, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @22, i32 0, i32 0) + call void (i8*, ...) @_lfortran_printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @23, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @20, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @18, i32 0, i32 0), i8* %13, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @19, i32 0, i32 0)) %14 = call i32 @__module_operator_overloading_01_overload_asterisk_m_bin_add(i1* %t, i1* %t) - call void (i8*, ...) @_lfortran_printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @32, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @30, i32 0, i32 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @31, i32 0, i32 0), i32 %14, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @29, i32 0, i32 0)) + call void (i8*, ...) @_lfortran_printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @27, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @26, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @24, i32 0, i32 0), i32 %14, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @25, i32 0, i32 0)) %15 = call i32 @__module_operator_overloading_01_overload_asterisk_m_bin_add(i1* %t, i1* %f) - call void (i8*, ...) @_lfortran_printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @37, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @35, i32 0, i32 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @36, i32 0, i32 0), i32 %15, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @34, i32 0, i32 0)) + call void (i8*, ...) @_lfortran_printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @31, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @30, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @28, i32 0, i32 0), i32 %15, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @29, i32 0, i32 0)) %16 = call i32 @__module_operator_overloading_01_overload_asterisk_m_bin_add(i1* %f, i1* %t) - call void (i8*, ...) @_lfortran_printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @42, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @40, i32 0, i32 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @41, i32 0, i32 0), i32 %16, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @39, i32 0, i32 0)) + call void (i8*, ...) @_lfortran_printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @35, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @34, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @32, i32 0, i32 0), i32 %16, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @33, i32 0, i32 0)) %17 = call i32 @__module_operator_overloading_01_overload_asterisk_m_bin_add(i1* %f, i1* %f) - call void (i8*, ...) @_lfortran_printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @47, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @45, i32 0, i32 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @46, i32 0, i32 0), i32 %17, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @44, i32 0, i32 0)) + call void (i8*, ...) @_lfortran_printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @39, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @38, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @36, i32 0, i32 0), i32 %17, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @37, i32 0, i32 0)) ret i32 0 } diff --git a/tests/reference/llvm-operator_overloading_02-adb886e.json b/tests/reference/llvm-operator_overloading_02-adb886e.json index cc89620ba2..f684d26e53 100644 --- a/tests/reference/llvm-operator_overloading_02-adb886e.json +++ b/tests/reference/llvm-operator_overloading_02-adb886e.json @@ -6,7 +6,7 @@ "outfile": null, "outfile_hash": null, "stdout": "llvm-operator_overloading_02-adb886e.stdout", - "stdout_hash": "a6339bd2fa21c32d3f0f224555dc297d50f06d98c100cb104457aa1c", + "stdout_hash": "ffe4059e6dbfe644ec484b5396f9ec7a8030c1a4129d218134b94cb0", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/llvm-operator_overloading_02-adb886e.stdout b/tests/reference/llvm-operator_overloading_02-adb886e.stdout index 6fa663ccdc..99cbaae66c 100644 --- a/tests/reference/llvm-operator_overloading_02-adb886e.stdout +++ b/tests/reference/llvm-operator_overloading_02-adb886e.stdout @@ -4,17 +4,15 @@ source_filename = "LFortran" @0 = private unnamed_addr constant [2 x i8] c" \00", align 1 @1 = private unnamed_addr constant [2 x i8] c"\0A\00", align 1 @2 = private unnamed_addr constant [6 x i8] c"tf=0:\00", align 1 -@3 = private unnamed_addr constant [1 x i8] zeroinitializer, align 1 -@4 = private unnamed_addr constant [6 x i8] c"False\00", align 1 -@5 = private unnamed_addr constant [5 x i8] c"True\00", align 1 -@6 = private unnamed_addr constant [9 x i8] c"%s%s%s%s\00", align 1 -@7 = private unnamed_addr constant [2 x i8] c" \00", align 1 -@8 = private unnamed_addr constant [2 x i8] c"\0A\00", align 1 -@9 = private unnamed_addr constant [6 x i8] c"tf=1:\00", align 1 -@10 = private unnamed_addr constant [1 x i8] zeroinitializer, align 1 -@11 = private unnamed_addr constant [6 x i8] c"False\00", align 1 -@12 = private unnamed_addr constant [5 x i8] c"True\00", align 1 -@13 = private unnamed_addr constant [9 x i8] c"%s%s%s%s\00", align 1 +@3 = private unnamed_addr constant [6 x i8] c"False\00", align 1 +@4 = private unnamed_addr constant [5 x i8] c"True\00", align 1 +@5 = private unnamed_addr constant [9 x i8] c"%s%s%s%s\00", align 1 +@6 = private unnamed_addr constant [2 x i8] c" \00", align 1 +@7 = private unnamed_addr constant [2 x i8] c"\0A\00", align 1 +@8 = private unnamed_addr constant [6 x i8] c"tf=1:\00", align 1 +@9 = private unnamed_addr constant [6 x i8] c"False\00", align 1 +@10 = private unnamed_addr constant [5 x i8] c"True\00", align 1 +@11 = private unnamed_addr constant [9 x i8] c"%s%s%s%s\00", align 1 define void @__module_overload_assignment_m_logical_gets_integer(i1* %tf, i32* %i) { .entry: @@ -37,14 +35,14 @@ define i32 @main(i32 %0, i8** %1) { call void @__module_overload_assignment_m_logical_gets_integer(i1* %tf, i32* %call_arg_value) %2 = load i1, i1* %tf, align 1 %3 = icmp eq i1 %2, false - %4 = select i1 %3, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @4, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @5, i32 0, i32 0) - call void (i8*, ...) @_lfortran_printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @6, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @2, i32 0, i32 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @3, i32 0, i32 0), i8* %4, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @1, i32 0, i32 0)) + %4 = select i1 %3, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @3, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @4, i32 0, i32 0) + call void (i8*, ...) @_lfortran_printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @5, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @2, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @0, i32 0, i32 0), i8* %4, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @1, i32 0, i32 0)) store i32 1, i32* %call_arg_value1, align 4 call void @__module_overload_assignment_m_logical_gets_integer(i1* %tf, i32* %call_arg_value1) %5 = load i1, i1* %tf, align 1 %6 = icmp eq i1 %5, false - %7 = select i1 %6, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @11, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @12, i32 0, i32 0) - call void (i8*, ...) @_lfortran_printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @13, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @9, i32 0, i32 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @10, i32 0, i32 0), i8* %7, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @8, i32 0, i32 0)) + %7 = select i1 %6, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @9, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @10, i32 0, i32 0) + call void (i8*, ...) @_lfortran_printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @11, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @8, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @6, i32 0, i32 0), i8* %7, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @7, i32 0, i32 0)) ret i32 0 } diff --git a/tests/reference/llvm-operator_overloading_03-d9fd880.json b/tests/reference/llvm-operator_overloading_03-d9fd880.json index 8bf9fa2797..d6eb0381c1 100644 --- a/tests/reference/llvm-operator_overloading_03-d9fd880.json +++ b/tests/reference/llvm-operator_overloading_03-d9fd880.json @@ -6,7 +6,7 @@ "outfile": null, "outfile_hash": null, "stdout": "llvm-operator_overloading_03-d9fd880.stdout", - "stdout_hash": "11c22fef8a148f23ccd3615ea7d7beda4902b1b860255f88918a8995", + "stdout_hash": "031ea033cc17e9c4af91135cf538383bc07ea7d1242db3578f0d9d66", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/llvm-operator_overloading_03-d9fd880.stdout b/tests/reference/llvm-operator_overloading_03-d9fd880.stdout index 164fb4798b..778bd3a63a 100644 --- a/tests/reference/llvm-operator_overloading_03-d9fd880.stdout +++ b/tests/reference/llvm-operator_overloading_03-d9fd880.stdout @@ -4,59 +4,51 @@ source_filename = "LFortran" @0 = private unnamed_addr constant [2 x i8] c" \00", align 1 @1 = private unnamed_addr constant [2 x i8] c"\0A\00", align 1 @2 = private unnamed_addr constant [5 x i8] c"T>T:\00", align 1 -@3 = private unnamed_addr constant [1 x i8] zeroinitializer, align 1 -@4 = private unnamed_addr constant [6 x i8] c"False\00", align 1 -@5 = private unnamed_addr constant [5 x i8] c"True\00", align 1 -@6 = private unnamed_addr constant [9 x i8] c"%s%s%s%s\00", align 1 -@7 = private unnamed_addr constant [2 x i8] c" \00", align 1 -@8 = private unnamed_addr constant [2 x i8] c"\0A\00", align 1 -@9 = private unnamed_addr constant [5 x i8] c"T>F:\00", align 1 -@10 = private unnamed_addr constant [1 x i8] zeroinitializer, align 1 -@11 = private unnamed_addr constant [6 x i8] c"False\00", align 1 -@12 = private unnamed_addr constant [5 x i8] c"True\00", align 1 -@13 = private unnamed_addr constant [9 x i8] c"%s%s%s%s\00", align 1 -@14 = private unnamed_addr constant [2 x i8] c" \00", align 1 -@15 = private unnamed_addr constant [2 x i8] c"\0A\00", align 1 -@16 = private unnamed_addr constant [5 x i8] c"F>T:\00", align 1 -@17 = private unnamed_addr constant [1 x i8] zeroinitializer, align 1 -@18 = private unnamed_addr constant [6 x i8] c"False\00", align 1 -@19 = private unnamed_addr constant [5 x i8] c"True\00", align 1 -@20 = private unnamed_addr constant [9 x i8] c"%s%s%s%s\00", align 1 -@21 = private unnamed_addr constant [2 x i8] c" \00", align 1 -@22 = private unnamed_addr constant [2 x i8] c"\0A\00", align 1 -@23 = private unnamed_addr constant [5 x i8] c"F>F:\00", align 1 -@24 = private unnamed_addr constant [1 x i8] zeroinitializer, align 1 -@25 = private unnamed_addr constant [6 x i8] c"False\00", align 1 -@26 = private unnamed_addr constant [5 x i8] c"True\00", align 1 -@27 = private unnamed_addr constant [9 x i8] c"%s%s%s%s\00", align 1 -@28 = private unnamed_addr constant [2 x i8] c" \00", align 1 -@29 = private unnamed_addr constant [2 x i8] c"\0A\00", align 1 -@30 = private unnamed_addr constant [5 x i8] c"TF:\00", align 1 +@9 = private unnamed_addr constant [6 x i8] c"False\00", align 1 +@10 = private unnamed_addr constant [5 x i8] c"True\00", align 1 +@11 = private unnamed_addr constant [9 x i8] c"%s%s%s%s\00", align 1 +@12 = private unnamed_addr constant [2 x i8] c" \00", align 1 +@13 = private unnamed_addr constant [2 x i8] c"\0A\00", align 1 +@14 = private unnamed_addr constant [5 x i8] c"F>T:\00", align 1 +@15 = private unnamed_addr constant [6 x i8] c"False\00", align 1 +@16 = private unnamed_addr constant [5 x i8] c"True\00", align 1 +@17 = private unnamed_addr constant [9 x i8] c"%s%s%s%s\00", align 1 +@18 = private unnamed_addr constant [2 x i8] c" \00", align 1 +@19 = private unnamed_addr constant [2 x i8] c"\0A\00", align 1 +@20 = private unnamed_addr constant [5 x i8] c"F>F:\00", align 1 +@21 = private unnamed_addr constant [6 x i8] c"False\00", align 1 +@22 = private unnamed_addr constant [5 x i8] c"True\00", align 1 +@23 = private unnamed_addr constant [9 x i8] c"%s%s%s%s\00", align 1 +@24 = private unnamed_addr constant [2 x i8] c" \00", align 1 +@25 = private unnamed_addr constant [2 x i8] c"\0A\00", align 1 +@26 = private unnamed_addr constant [5 x i8] c"T