From 0c88ed1264593ca4807c8319e24201a0adc1d86f Mon Sep 17 00:00:00 2001 From: dingguangya Date: Sat, 25 Mar 2023 16:28:21 +0800 Subject: [PATCH] [Update] Fix TreeToValue-VAR_DECL and ARRAY_TYPE-getDomainIndex (cherry picked from commit 89dacd7371f4bbef6320a883920b31426395eec8) --- ...ix-TreeToValue-VAR_DECL-and-ARRAY_TY.patch | 41 +++++++++++++++++++ pin-gcc-client.spec | 10 ++++- 2 files changed, 50 insertions(+), 1 deletion(-) create mode 100644 0009-Pin-gcc-client-Fix-TreeToValue-VAR_DECL-and-ARRAY_TY.patch diff --git a/0009-Pin-gcc-client-Fix-TreeToValue-VAR_DECL-and-ARRAY_TY.patch b/0009-Pin-gcc-client-Fix-TreeToValue-VAR_DECL-and-ARRAY_TY.patch new file mode 100644 index 0000000..71477c9 --- /dev/null +++ b/0009-Pin-gcc-client-Fix-TreeToValue-VAR_DECL-and-ARRAY_TY.patch @@ -0,0 +1,41 @@ +From 1a2836f9dcd00d8666acf33cbbf0ba58c821676b Mon Sep 17 00:00:00 2001 +From: d00573793 +Date: Fri, 24 Mar 2023 17:35:51 +0800 +Subject: [PATCH] [Pin-gcc-client] Fix TreeToValue-VAR_DECL and + ARRAY_TYPE-getDomainIndex + + +diff --git a/lib/Translate/GimpleToPluginOps.cpp b/lib/Translate/GimpleToPluginOps.cpp +index d1b8319..80d4e87 100644 +--- a/lib/Translate/GimpleToPluginOps.cpp ++++ b/lib/Translate/GimpleToPluginOps.cpp +@@ -1601,7 +1601,9 @@ Value GimpleToPluginOps::TreeToValue(uint64_t treeId) + bool addressable = TREE_ADDRESSABLE(t); + bool used = TREE_USED(t); + int32_t uid = DECL_UID(t); +- mlir::Value initial = TreeToValue((uint64_t)DECL_INITIAL(t)); ++ // Fixme: DECL_INITIAL(t) This function causes a memory access error after repeated TreeToValue iterations. ++ // postgresql-11.3 ICE ++ mlir::Value initial = builder.create(builder.getUnknownLoc(), 0, IDefineCode::UNDEF, 0, rPluginType); + mlir::Value name = TreeToValue((uint64_t)DECL_NAME(t)); + llvm::Optional chain = (uint64_t)DECL_CHAIN(t); + GetTreeAttr(treeId, readOnly, rPluginType); +diff --git a/lib/Translate/TypeTranslation.cpp b/lib/Translate/TypeTranslation.cpp +index 8a0a674..e18f7f5 100644 +--- a/lib/Translate/TypeTranslation.cpp ++++ b/lib/Translate/TypeTranslation.cpp +@@ -81,7 +81,10 @@ private: + + unsigned getDomainIndex (tree type) + { +- if (TYPE_DOMAIN(type) && TYPE_MAX_VALUE(TYPE_DOMAIN(type))) ++ if (TYPE_DOMAIN(type) && TYPE_MAX_VALUE(TYPE_DOMAIN(type)) ++ && TYPE_MIN_VALUE(TYPE_DOMAIN(type)) ++ && TREE_CODE (TYPE_MIN_VALUE (TYPE_DOMAIN (type))) == INTEGER_CST ++ && TREE_CODE (TYPE_MAX_VALUE (TYPE_DOMAIN (type))) == INTEGER_CST) + return tree_to_shwi(TYPE_MAX_VALUE(TYPE_DOMAIN(type)))+1; + return 0; + } +-- +2.33.0 + diff --git a/pin-gcc-client.spec b/pin-gcc-client.spec index 3bcc8ca..28f4865 100644 --- a/pin-gcc-client.spec +++ b/pin-gcc-client.spec @@ -1,6 +1,6 @@ Name: pin-gcc-client Version: 0.4.1 -Release: 5 +Release: 6 Summary: A Pin (Plug-IN framework) client is implemented based on GCC plugin and can execute the compiler optimization pass in GCC. License: GPLv3+ and GPLv3+ with exceptions and GPLv2+ with exceptions and LGPLv2+ and BSD URL: https://gitee.com/src-openeuler/pin-gcc-client @@ -18,6 +18,7 @@ Patch5: 0005-Pin-gcc-client-Add-support-for-decl-and-field-SetDec.patch Patch6: 0006-Pin-gcc-client-Add-GetDeclType.patch Patch7: 0007-Pin-gcc-client-Fix-VectorType.patch Patch8: 0008-Pin-gcc-client-Fix-struct-self-contained-CallOp-Tree.patch +Patch9: 0009-Pin-gcc-client-Fix-TreeToValue-VAR_DECL-and-ARRAY_TY.patch %description A Pin (Plug-IN framework) client is implemented based on GCC plugin and can execute the compiler optimization pass in GCC. @@ -33,6 +34,7 @@ A Pin (Plug-IN framework) client is implemented based on GCC plugin and can exec %patch6 -p1 %patch7 -p1 %patch8 -p1 +%patch9 -p1 mkdir -p _build cd _build @@ -69,6 +71,12 @@ find %{_libdir} -type f -name "*.so" -exec strip "{}" ";" %config(noreplace) /etc/ld.so.conf.d/%{name}-%{_arch}.conf %changelog +* Sat 25 2023 dingguangya - 0.4.1-6 +- Type:Update +- ID:NA +- SUG:NA +- DESC:Fix TreeToValue-VAR_DECL and ARRAY_TYPE-getDomainIndex + * Fri Mar 17 2023 dingguangya - 0.4.1-5 - Type:Update - ID:NA -- Gitee