From a277d13a29abdb171bfd7f4acd94c72e7c126991 Mon Sep 17 00:00:00 2001 From: Ron Lieberman Date: Sat, 23 Jul 2022 16:45:35 +0000 Subject: [PATCH 1/4] Add flag -Wno-int-conversion to cover changing llvm defaults --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 2e277882c8..5d3baec11b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -298,7 +298,7 @@ else() set(FLANG_HAS_VERSION_PATCHLEVEL 0) endif() -set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fcommon -Wno-implicit-function-declaration -Wno-implicit-int") +set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fcommon -Wno-implicit-function-declaration -Wno-implicit-int -Wno-int-conversion") # Add appropriate flags for GCC if (LLVM_COMPILER_IS_GCC_COMPATIBLE) From 5fa762054787343c754c0f4566d4fb44fdbd3020 Mon Sep 17 00:00:00 2001 From: Ron Lieberman Date: Mon, 25 Jul 2022 10:21:08 -0500 Subject: [PATCH 2/4] Fix for flang swdev-324643 --- tools/flang1/flang1exe/semsmp.c | 8 +++++++ tools/flang2/flang2exe/cgmain.cpp | 2 +- tools/flang2/flang2exe/ll_ftn.cpp | 4 ++-- tools/flang2/flang2exe/ll_write.cpp | 36 ++++++++++++++--------------- tools/flang2/flang2exe/lldebug.cpp | 8 +++---- tools/flang2/flang2exe/llutil.cpp | 6 ++--- tools/flang2/flang2exe/outliner.cpp | 12 +++++----- 7 files changed, 42 insertions(+), 34 deletions(-) diff --git a/tools/flang1/flang1exe/semsmp.c b/tools/flang1/flang1exe/semsmp.c index 0dde1b98d1..5f218d8ea0 100644 --- a/tools/flang1/flang1exe/semsmp.c +++ b/tools/flang1/flang1exe/semsmp.c @@ -8221,6 +8221,10 @@ do_tofrom() (void)add_stmt(ast); A_LOPP(ast, item->ast); A_PRAGMATYPEP(ast, item->t.cltype); + // AOCC Begin + if (A_TYPEG(item->ast) == A_MEM) + A_ROPP(ast, A_PARENTG(item->ast)); + // AOCC End } } if (CL_PRESENT(CL_FROM)) { @@ -8230,6 +8234,10 @@ do_tofrom() (void)add_stmt(ast); A_LOPP(ast, item->ast); A_PRAGMATYPEP(ast, item->t.cltype); + // AOCC Begin + if (A_TYPEG(item->ast) == A_MEM) + A_ROPP(ast, A_PARENTG(item->ast)); + // AOCC End } } ast = mk_stmt(A_MP_EMAP, 0); diff --git a/tools/flang2/flang2exe/cgmain.cpp b/tools/flang2/flang2exe/cgmain.cpp index 797024be65..999069b7d6 100644 --- a/tools/flang2/flang2exe/cgmain.cpp +++ b/tools/flang2/flang2exe/cgmain.cpp @@ -14924,7 +14924,7 @@ store_return_value_for_entry(OPERAND *p, int i_name) print_token(", align 4\n"); } else { TMPS *loadtmp; - /* %10 = bitcast i64* %__master_entry_rslt323 to <{float, float}>* */ + /* %10 = bitcast ptr %__master_entry_rslt323 to <{float, float}>* */ print_token("\t"); print_tmp_name(tmp); print_token(" = bitcast "); diff --git a/tools/flang2/flang2exe/ll_ftn.cpp b/tools/flang2/flang2exe/ll_ftn.cpp index aa7f05facf..0ad136dccc 100644 --- a/tools/flang2/flang2exe/ll_ftn.cpp +++ b/tools/flang2/flang2exe/ll_ftn.cpp @@ -331,7 +331,7 @@ ll_process_routine_parameters(SPTR func_sptr) param_num = 0; /* Create a dummy LL_Type for use when passing by ref. - * This will either be a i32* or i64*. + * This will either be a ptr or ptr. */ ref_dtype = generic_dummy_dtype(); ref_dummy = make_generic_dummy_lltype(); @@ -1398,7 +1398,7 @@ print_entry_subroutine(LL_Module *module) if (!DT_ISCMPLX(rettype) || !CMPLXFUNC_C) { return_ll_type = make_lltype_from_dtype(rettype); - /* %1 = load i32, i32* %cp1_300, align 4 */ + /* %1 = load i32, ptr %cp1_300, align 4 */ tmp = make_tmps(); print_tmp_name(tmp); print_token(" = load "); diff --git a/tools/flang2/flang2exe/ll_write.cpp b/tools/flang2/flang2exe/ll_write.cpp index 46ae80a811..bf88ebd0b4 100644 --- a/tools/flang2/flang2exe/ll_write.cpp +++ b/tools/flang2/flang2exe/ll_write.cpp @@ -827,38 +827,38 @@ ll_write_local_objects(FILE *out, LL_Function *function) name = object->address.data; if (ll_type_bytes(object->type) == 4) { if (object->type->data_type == LL_I32) { - fprintf(out, "\tstore i32 %s, i32* %s, align 4\n", + fprintf(out, "\tstore i32 %s, ptr %s, align 4\n", POWER_STACK_32_BIT_NAN, name); } else { - fprintf(out, "\t%s.temp = bitcast %s* %s to i32*\n", name, + fprintf(out, "\t%s.temp = bitcast %s* %s to ptr\n", name, object->type->str, name); - fprintf(out, "\tstore i32 %s, i32* %s.temp, align 4\n", + fprintf(out, "\tstore i32 %s, ptr %s.temp, align 4\n", POWER_STACK_32_BIT_NAN, name); } } else if (ll_type_bytes(object->type) == 8) { if (object->type->data_type == LL_I64) { - fprintf(out, "\tstore i64 %s, i64* %s, align 8\n", + fprintf(out, "\tstore i64 %s, ptr %s, align 8\n", POWER_STACK_64_BIT_NAN, name); } else { - fprintf(out, "\t%s.temp = bitcast %s* %s to i64*\n", name, + fprintf(out, "\t%s.temp = bitcast %s* %s to ptr\n", name, object->type->str, name); - fprintf(out, "\tstore i64 %s, i64* %s.temp, align 8\n", + fprintf(out, "\tstore i64 %s, ptr %s.temp, align 8\n", POWER_STACK_64_BIT_NAN, name); } } else if (ll_type_bytes(object->type) > 4) { - fprintf(out, "\t%s.temp = bitcast %s* %s to i32*\n", name, + fprintf(out, "\t%s.temp = bitcast %s* %s to ptr\n", name, object->type->str, name); - fprintf(out, "\t%s.ptr = alloca i32*, align 4\n", name); + fprintf(out, "\t%s.ptr = alloca ptr, align 4\n", name); fprintf(out, "\t%s.count = alloca i32, align 4\n", name); - fprintf(out, "\tstore i32 %d, i32* %s.count, align 4\n", + fprintf(out, "\tstore i32 %d, ptr %s.count, align 4\n", (int)(ll_type_bytes(object->type) / 4), name); - fprintf(out, "\t%s.temp0 = bitcast i32* %s.temp to i8*\n", name, name); - fprintf(out, "\t%s.temp1 = bitcast i32** %s.ptr to i8**\n", name, name); + fprintf(out, "\t%s.temp0 = bitcast ptr %s.temp to i8*\n", name, name); + fprintf(out, "\t%s.temp1 = bitcast ptr* %s.ptr to i8**\n", name, name); fprintf(out, "\tstore i8* %s.temp0, i8** %s.temp1, align 4\n", name, name); fprintf(out, "\tbr label %%L.st.init.%04d.1\n", curr_nan_label_count); fprintf(out, "L.st.init.%04d.1:\n", curr_nan_label_count); - fprintf(out, "\t%s.temp2 = load i32, i32* %s.count, align 4\n", name, + fprintf(out, "\t%s.temp2 = load i32, ptr %s.count, align 4\n", name, name); fprintf(out, "\t%s.temp3 = icmp sle i32 %s.temp2, 0\n", name, name); fprintf(out, @@ -866,20 +866,20 @@ ll_write_local_objects(FILE *out, LL_Function *function) " label %%L.st.init.%04d.2\n", name, curr_nan_label_count + 1, curr_nan_label_count); fprintf(out, "L.st.init.%04d.2:\n", curr_nan_label_count); - fprintf(out, "\t%s.temp4 = load i32*, i32** %s.ptr, align 4\n", name, + fprintf(out, "\t%s.temp4 = load ptr, ptr* %s.ptr, align 4\n", name, name); - fprintf(out, "\tstore i32 %s, i32* %s.temp4, align 4\n", + fprintf(out, "\tstore i32 %s, ptr %s.temp4, align 4\n", POWER_STACK_32_BIT_NAN, name); - fprintf(out, "\t%s.temp5 = bitcast i32* %s.temp4 to i8*\n", name, name); + fprintf(out, "\t%s.temp5 = bitcast ptr %s.temp4 to i8*\n", name, name); fprintf(out, "\t%s.temp6 = getelementptr i8, i8* %s.temp5, i32 4\n", name, name); - fprintf(out, "\t%s.temp7 = bitcast i32** %s.ptr to i8**\n", name, name); + fprintf(out, "\t%s.temp7 = bitcast ptr* %s.ptr to i8**\n", name, name); fprintf(out, "\tstore i8* %s.temp6, i8** %s.temp7, align 4\n", name, name); - fprintf(out, "\t%s.temp8 = load i32, i32* %s.count, align 4\n", name, + fprintf(out, "\t%s.temp8 = load i32, ptr %s.count, align 4\n", name, name); fprintf(out, "\t%s.temp9 = sub i32 %s.temp8, 1\n", name, name); - fprintf(out, "\tstore i32 %s.temp9, i32* %s.count, align 4\n", name, + fprintf(out, "\tstore i32 %s.temp9, ptr %s.count, align 4\n", name, name); fprintf(out, "\tbr label %%L.st.init.%04d.1\n", curr_nan_label_count); curr_nan_label_count++; diff --git a/tools/flang2/flang2exe/lldebug.cpp b/tools/flang2/flang2exe/lldebug.cpp index 84422551e6..136de8ae7c 100644 --- a/tools/flang2/flang2exe/lldebug.cpp +++ b/tools/flang2/flang2exe/lldebug.cpp @@ -1625,12 +1625,12 @@ lldbg_create_local_variable_mdnode(LL_DebugInfo *db, int dw_tag, * unique metadata node. Avoiding "Overlapping fragments". * * Incorrect case: Overlapping fragments: - * call void @llvm.dbg.declare(metadata i64* %tmp.sroa.0, metadata !19, metadata !DIExpression(DW_OP_LLVM_fragment, 0, 64)).. - * call void @llvm.dbg.declare(metadata i64* %tmp.sroa.5, metadata !19, metadata !DIExpression(DW_OP_LLVM_fragment, 0 64)).. + * call void @llvm.dbg.declare(metadata ptr %tmp.sroa.0, metadata !19, metadata !DIExpression(DW_OP_LLVM_fragment, 0, 64)).. + * call void @llvm.dbg.declare(metadata ptr %tmp.sroa.5, metadata !19, metadata !DIExpression(DW_OP_LLVM_fragment, 0 64)).. * * Corected case: No-Overlapping fragments: - * call void @llvm.dbg.declare(metadata i64* %tmp.sroa.0, metadata !19, metadata !DIExpression(DW_OP_LLVM_fragment, 0, 64)).. - * call void @llvm.dbg.declare(metadata i64* %tmp.sroa.5, metadata !20, metadata !DIExpression(DW_OP_LLVM_fragment, 0 64)).. + * call void @llvm.dbg.declare(metadata ptr %tmp.sroa.0, metadata !19, metadata !DIExpression(DW_OP_LLVM_fragment, 0, 64)).. + * call void @llvm.dbg.declare(metadata ptr %tmp.sroa.5, metadata !20, metadata !DIExpression(DW_OP_LLVM_fragment, 0 64)).. * */ llmd_set_distinct(mdb); } diff --git a/tools/flang2/flang2exe/llutil.cpp b/tools/flang2/flang2exe/llutil.cpp index 5f6ce53756..d4c1b67677 100644 --- a/tools/flang2/flang2exe/llutil.cpp +++ b/tools/flang2/flang2exe/llutil.cpp @@ -994,7 +994,7 @@ generic_dummy_dtype(void) } /* This was originally just i8*, but to avoid only loading 1 byte, - * we now represent dummys as i32* or i64* in fortran. + * we now represent dummys as ptr or ptr in fortran. */ LL_Type * make_generic_dummy_lltype(void) @@ -1404,7 +1404,7 @@ make_lltype_from_sptr(SPTR sptr) if (llis_integral_kind(sdtype)) { /* do nothing */ } else if (llis_pointer_kind(sdtype)) { - /* make it i8* - use i32* or i64* */ + /* make it i8* - use ptr or ptr */ if (sc == SC_DUMMY) return make_generic_dummy_lltype(); if (DTY(sdtype) == TY_PTR && sdtype != DT_ADDR) @@ -1417,7 +1417,7 @@ make_lltype_from_sptr(SPTR sptr) llt = ll_get_pointer_type(ll_create_int_type(llvm_get_current_module(), 8)); } } else if (llis_array_kind(sdtype)) { - /* all dummy argument are i32* or i64* */ + /* all dummy argument are ptr or ptr */ if (SCG(sptr) == SC_DUMMY) { llt = make_generic_dummy_lltype(); goto return_llt; diff --git a/tools/flang2/flang2exe/outliner.cpp b/tools/flang2/flang2exe/outliner.cpp index a5771896ac..b2828077d4 100644 --- a/tools/flang2/flang2exe/outliner.cpp +++ b/tools/flang2/flang2exe/outliner.cpp @@ -593,7 +593,7 @@ findBihForGtid() * where 'this' is gbl.curr_func. * * * If this is a task, the 1st formal param represents the gtid: i32 gtid. - * * If this is an outlined func, the 1st formal represents gtid: i32* gtid. + * * If this is an outlined func, the 1st formal represents gtid: ptr gtid. */ int ll_get_gtid_val_ili(void) @@ -717,13 +717,13 @@ ll_make_sections_args(SPTR lbSym, SPTR ubSym, SPTR stSym, SPTR lastSym) { static int args[9]; - args[8] = genNullArg(); /* i32* ident */ + args[8] = genNullArg(); /* ptr ident */ args[7] = ll_get_gtid_val_ili(); /* i32 tid */ args[6] = ad_icon(KMP_SCH_STATIC); /* i32 schedule */ - args[5] = ad_acon(lastSym, 0); /* i32* plastiter */ - args[4] = ad_acon(lbSym, 0); /* i32* plower */ - args[3] = ad_acon(ubSym, 0); /* i32* pupper */ - args[2] = ad_acon(stSym, 0); /* i32* pstridr */ + args[5] = ad_acon(lastSym, 0); /* ptr plastiter */ + args[4] = ad_acon(lbSym, 0); /* ptr plower */ + args[3] = ad_acon(ubSym, 0); /* ptr pupper */ + args[2] = ad_acon(stSym, 0); /* ptr pstridr */ args[1] = ad_icon(1); /* i32 incr */ args[0] = ad_icon(0); /* i32 chunk */ ADDRTKNP(lbSym, 1); From 2a355767998bdcff6e42a676db797ad123a3e0b4 Mon Sep 17 00:00:00 2001 From: Ron Lieberman Date: Tue, 26 Jul 2022 07:29:22 -0500 Subject: [PATCH 3/4] Cleanup inadvertent unrelated commented files --- tools/flang2/flang2exe/cgmain.cpp | 2 +- tools/flang2/flang2exe/ll_ftn.cpp | 4 ++-- tools/flang2/flang2exe/ll_write.cpp | 36 ++++++++++++++--------------- tools/flang2/flang2exe/lldebug.cpp | 8 +++---- tools/flang2/flang2exe/llutil.cpp | 6 ++--- tools/flang2/flang2exe/outliner.cpp | 12 +++++----- 6 files changed, 34 insertions(+), 34 deletions(-) diff --git a/tools/flang2/flang2exe/cgmain.cpp b/tools/flang2/flang2exe/cgmain.cpp index 999069b7d6..797024be65 100644 --- a/tools/flang2/flang2exe/cgmain.cpp +++ b/tools/flang2/flang2exe/cgmain.cpp @@ -14924,7 +14924,7 @@ store_return_value_for_entry(OPERAND *p, int i_name) print_token(", align 4\n"); } else { TMPS *loadtmp; - /* %10 = bitcast ptr %__master_entry_rslt323 to <{float, float}>* */ + /* %10 = bitcast i64* %__master_entry_rslt323 to <{float, float}>* */ print_token("\t"); print_tmp_name(tmp); print_token(" = bitcast "); diff --git a/tools/flang2/flang2exe/ll_ftn.cpp b/tools/flang2/flang2exe/ll_ftn.cpp index 0ad136dccc..aa7f05facf 100644 --- a/tools/flang2/flang2exe/ll_ftn.cpp +++ b/tools/flang2/flang2exe/ll_ftn.cpp @@ -331,7 +331,7 @@ ll_process_routine_parameters(SPTR func_sptr) param_num = 0; /* Create a dummy LL_Type for use when passing by ref. - * This will either be a ptr or ptr. + * This will either be a i32* or i64*. */ ref_dtype = generic_dummy_dtype(); ref_dummy = make_generic_dummy_lltype(); @@ -1398,7 +1398,7 @@ print_entry_subroutine(LL_Module *module) if (!DT_ISCMPLX(rettype) || !CMPLXFUNC_C) { return_ll_type = make_lltype_from_dtype(rettype); - /* %1 = load i32, ptr %cp1_300, align 4 */ + /* %1 = load i32, i32* %cp1_300, align 4 */ tmp = make_tmps(); print_tmp_name(tmp); print_token(" = load "); diff --git a/tools/flang2/flang2exe/ll_write.cpp b/tools/flang2/flang2exe/ll_write.cpp index bf88ebd0b4..46ae80a811 100644 --- a/tools/flang2/flang2exe/ll_write.cpp +++ b/tools/flang2/flang2exe/ll_write.cpp @@ -827,38 +827,38 @@ ll_write_local_objects(FILE *out, LL_Function *function) name = object->address.data; if (ll_type_bytes(object->type) == 4) { if (object->type->data_type == LL_I32) { - fprintf(out, "\tstore i32 %s, ptr %s, align 4\n", + fprintf(out, "\tstore i32 %s, i32* %s, align 4\n", POWER_STACK_32_BIT_NAN, name); } else { - fprintf(out, "\t%s.temp = bitcast %s* %s to ptr\n", name, + fprintf(out, "\t%s.temp = bitcast %s* %s to i32*\n", name, object->type->str, name); - fprintf(out, "\tstore i32 %s, ptr %s.temp, align 4\n", + fprintf(out, "\tstore i32 %s, i32* %s.temp, align 4\n", POWER_STACK_32_BIT_NAN, name); } } else if (ll_type_bytes(object->type) == 8) { if (object->type->data_type == LL_I64) { - fprintf(out, "\tstore i64 %s, ptr %s, align 8\n", + fprintf(out, "\tstore i64 %s, i64* %s, align 8\n", POWER_STACK_64_BIT_NAN, name); } else { - fprintf(out, "\t%s.temp = bitcast %s* %s to ptr\n", name, + fprintf(out, "\t%s.temp = bitcast %s* %s to i64*\n", name, object->type->str, name); - fprintf(out, "\tstore i64 %s, ptr %s.temp, align 8\n", + fprintf(out, "\tstore i64 %s, i64* %s.temp, align 8\n", POWER_STACK_64_BIT_NAN, name); } } else if (ll_type_bytes(object->type) > 4) { - fprintf(out, "\t%s.temp = bitcast %s* %s to ptr\n", name, + fprintf(out, "\t%s.temp = bitcast %s* %s to i32*\n", name, object->type->str, name); - fprintf(out, "\t%s.ptr = alloca ptr, align 4\n", name); + fprintf(out, "\t%s.ptr = alloca i32*, align 4\n", name); fprintf(out, "\t%s.count = alloca i32, align 4\n", name); - fprintf(out, "\tstore i32 %d, ptr %s.count, align 4\n", + fprintf(out, "\tstore i32 %d, i32* %s.count, align 4\n", (int)(ll_type_bytes(object->type) / 4), name); - fprintf(out, "\t%s.temp0 = bitcast ptr %s.temp to i8*\n", name, name); - fprintf(out, "\t%s.temp1 = bitcast ptr* %s.ptr to i8**\n", name, name); + fprintf(out, "\t%s.temp0 = bitcast i32* %s.temp to i8*\n", name, name); + fprintf(out, "\t%s.temp1 = bitcast i32** %s.ptr to i8**\n", name, name); fprintf(out, "\tstore i8* %s.temp0, i8** %s.temp1, align 4\n", name, name); fprintf(out, "\tbr label %%L.st.init.%04d.1\n", curr_nan_label_count); fprintf(out, "L.st.init.%04d.1:\n", curr_nan_label_count); - fprintf(out, "\t%s.temp2 = load i32, ptr %s.count, align 4\n", name, + fprintf(out, "\t%s.temp2 = load i32, i32* %s.count, align 4\n", name, name); fprintf(out, "\t%s.temp3 = icmp sle i32 %s.temp2, 0\n", name, name); fprintf(out, @@ -866,20 +866,20 @@ ll_write_local_objects(FILE *out, LL_Function *function) " label %%L.st.init.%04d.2\n", name, curr_nan_label_count + 1, curr_nan_label_count); fprintf(out, "L.st.init.%04d.2:\n", curr_nan_label_count); - fprintf(out, "\t%s.temp4 = load ptr, ptr* %s.ptr, align 4\n", name, + fprintf(out, "\t%s.temp4 = load i32*, i32** %s.ptr, align 4\n", name, name); - fprintf(out, "\tstore i32 %s, ptr %s.temp4, align 4\n", + fprintf(out, "\tstore i32 %s, i32* %s.temp4, align 4\n", POWER_STACK_32_BIT_NAN, name); - fprintf(out, "\t%s.temp5 = bitcast ptr %s.temp4 to i8*\n", name, name); + fprintf(out, "\t%s.temp5 = bitcast i32* %s.temp4 to i8*\n", name, name); fprintf(out, "\t%s.temp6 = getelementptr i8, i8* %s.temp5, i32 4\n", name, name); - fprintf(out, "\t%s.temp7 = bitcast ptr* %s.ptr to i8**\n", name, name); + fprintf(out, "\t%s.temp7 = bitcast i32** %s.ptr to i8**\n", name, name); fprintf(out, "\tstore i8* %s.temp6, i8** %s.temp7, align 4\n", name, name); - fprintf(out, "\t%s.temp8 = load i32, ptr %s.count, align 4\n", name, + fprintf(out, "\t%s.temp8 = load i32, i32* %s.count, align 4\n", name, name); fprintf(out, "\t%s.temp9 = sub i32 %s.temp8, 1\n", name, name); - fprintf(out, "\tstore i32 %s.temp9, ptr %s.count, align 4\n", name, + fprintf(out, "\tstore i32 %s.temp9, i32* %s.count, align 4\n", name, name); fprintf(out, "\tbr label %%L.st.init.%04d.1\n", curr_nan_label_count); curr_nan_label_count++; diff --git a/tools/flang2/flang2exe/lldebug.cpp b/tools/flang2/flang2exe/lldebug.cpp index 136de8ae7c..84422551e6 100644 --- a/tools/flang2/flang2exe/lldebug.cpp +++ b/tools/flang2/flang2exe/lldebug.cpp @@ -1625,12 +1625,12 @@ lldbg_create_local_variable_mdnode(LL_DebugInfo *db, int dw_tag, * unique metadata node. Avoiding "Overlapping fragments". * * Incorrect case: Overlapping fragments: - * call void @llvm.dbg.declare(metadata ptr %tmp.sroa.0, metadata !19, metadata !DIExpression(DW_OP_LLVM_fragment, 0, 64)).. - * call void @llvm.dbg.declare(metadata ptr %tmp.sroa.5, metadata !19, metadata !DIExpression(DW_OP_LLVM_fragment, 0 64)).. + * call void @llvm.dbg.declare(metadata i64* %tmp.sroa.0, metadata !19, metadata !DIExpression(DW_OP_LLVM_fragment, 0, 64)).. + * call void @llvm.dbg.declare(metadata i64* %tmp.sroa.5, metadata !19, metadata !DIExpression(DW_OP_LLVM_fragment, 0 64)).. * * Corected case: No-Overlapping fragments: - * call void @llvm.dbg.declare(metadata ptr %tmp.sroa.0, metadata !19, metadata !DIExpression(DW_OP_LLVM_fragment, 0, 64)).. - * call void @llvm.dbg.declare(metadata ptr %tmp.sroa.5, metadata !20, metadata !DIExpression(DW_OP_LLVM_fragment, 0 64)).. + * call void @llvm.dbg.declare(metadata i64* %tmp.sroa.0, metadata !19, metadata !DIExpression(DW_OP_LLVM_fragment, 0, 64)).. + * call void @llvm.dbg.declare(metadata i64* %tmp.sroa.5, metadata !20, metadata !DIExpression(DW_OP_LLVM_fragment, 0 64)).. * */ llmd_set_distinct(mdb); } diff --git a/tools/flang2/flang2exe/llutil.cpp b/tools/flang2/flang2exe/llutil.cpp index d4c1b67677..5f6ce53756 100644 --- a/tools/flang2/flang2exe/llutil.cpp +++ b/tools/flang2/flang2exe/llutil.cpp @@ -994,7 +994,7 @@ generic_dummy_dtype(void) } /* This was originally just i8*, but to avoid only loading 1 byte, - * we now represent dummys as ptr or ptr in fortran. + * we now represent dummys as i32* or i64* in fortran. */ LL_Type * make_generic_dummy_lltype(void) @@ -1404,7 +1404,7 @@ make_lltype_from_sptr(SPTR sptr) if (llis_integral_kind(sdtype)) { /* do nothing */ } else if (llis_pointer_kind(sdtype)) { - /* make it i8* - use ptr or ptr */ + /* make it i8* - use i32* or i64* */ if (sc == SC_DUMMY) return make_generic_dummy_lltype(); if (DTY(sdtype) == TY_PTR && sdtype != DT_ADDR) @@ -1417,7 +1417,7 @@ make_lltype_from_sptr(SPTR sptr) llt = ll_get_pointer_type(ll_create_int_type(llvm_get_current_module(), 8)); } } else if (llis_array_kind(sdtype)) { - /* all dummy argument are ptr or ptr */ + /* all dummy argument are i32* or i64* */ if (SCG(sptr) == SC_DUMMY) { llt = make_generic_dummy_lltype(); goto return_llt; diff --git a/tools/flang2/flang2exe/outliner.cpp b/tools/flang2/flang2exe/outliner.cpp index b2828077d4..a5771896ac 100644 --- a/tools/flang2/flang2exe/outliner.cpp +++ b/tools/flang2/flang2exe/outliner.cpp @@ -593,7 +593,7 @@ findBihForGtid() * where 'this' is gbl.curr_func. * * * If this is a task, the 1st formal param represents the gtid: i32 gtid. - * * If this is an outlined func, the 1st formal represents gtid: ptr gtid. + * * If this is an outlined func, the 1st formal represents gtid: i32* gtid. */ int ll_get_gtid_val_ili(void) @@ -717,13 +717,13 @@ ll_make_sections_args(SPTR lbSym, SPTR ubSym, SPTR stSym, SPTR lastSym) { static int args[9]; - args[8] = genNullArg(); /* ptr ident */ + args[8] = genNullArg(); /* i32* ident */ args[7] = ll_get_gtid_val_ili(); /* i32 tid */ args[6] = ad_icon(KMP_SCH_STATIC); /* i32 schedule */ - args[5] = ad_acon(lastSym, 0); /* ptr plastiter */ - args[4] = ad_acon(lbSym, 0); /* ptr plower */ - args[3] = ad_acon(ubSym, 0); /* ptr pupper */ - args[2] = ad_acon(stSym, 0); /* ptr pstridr */ + args[5] = ad_acon(lastSym, 0); /* i32* plastiter */ + args[4] = ad_acon(lbSym, 0); /* i32* plower */ + args[3] = ad_acon(ubSym, 0); /* i32* pupper */ + args[2] = ad_acon(stSym, 0); /* i32* pstridr */ args[1] = ad_icon(1); /* i32 incr */ args[0] = ad_icon(0); /* i32 chunk */ ADDRTKNP(lbSym, 1); From ffc54796c40b393a4bfa87de208a29fcdf509728 Mon Sep 17 00:00:00 2001 From: estewart08 Date: Mon, 1 Aug 2022 21:40:09 -0500 Subject: [PATCH 4/4] Use find_library instead of -l to find libquadmath. (#59) Centos-9 had an issue where this library was not being found. We should instead use find_library to allow certain names to be searched in case the OS does not have a libquadmath.so symlink. The build will now fail in the cmake step if quadmath is not found. --- CMakeLists.txt | 4 +++- runtime/flangrti/CMakeLists.txt | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5d3baec11b..18d16fdae1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -313,6 +313,8 @@ if (APPLE) set(CMAKE_MODULE_LINKER_FLAGS "-Wl,-flat_namespace -Wl,-undefined -Wl,suppress") endif () +find_library(LIBQUADMATH_LOC quadmath NAMES libquadmath.so libquadmath.so.0 REQUIRED) + macro(add_flang_library name) llvm_process_sources(srcs ${ARGN}) if (MODULE) @@ -329,7 +331,7 @@ macro(add_flang_library name) endif( LLVM_COMMON_DEPENDS ) llvm_config( ${name} ${LLVM_LINK_COMPONENTS} ) - target_link_libraries( ${name} ${LLVM_COMMON_LIBS} -lquadmath) + target_link_libraries( ${name} ${LLVM_COMMON_LIBS} ${LIBQUADMATH_LOC}) # link_system_libs( ${name} ) # getd of cmake warning messages install(TARGETS ${name} diff --git a/runtime/flangrti/CMakeLists.txt b/runtime/flangrti/CMakeLists.txt index a032ca0268..3e1d7f09e8 100644 --- a/runtime/flangrti/CMakeLists.txt +++ b/runtime/flangrti/CMakeLists.txt @@ -107,7 +107,7 @@ find_library( libpgmath.so HINTS ${CMAKE_BINARY_DIR}/lib) target_link_libraries(flangrti_shared ${LIBPGMATH} -Wl,-rpath,\$ORIGIN) -target_link_libraries(flangrti_shared quadmath) +target_link_libraries(flangrti_shared ${LIBQUADMATH_LOC}) if( ${TARGET_ARCHITECTURE} STREQUAL "aarch64" ) target_compile_definitions(flangrti_static PRIVATE TARGET_LINUX_ARM)