!40 [Update] Fix TreeToValue-VAR_DECL and ARRAY_TYPE-getDomainIndex

From: @dguangya 
Reviewed-by: @li-yancheng 
Signed-off-by: @li-yancheng
This commit is contained in:
openeuler-ci-bot 2023-03-26 08:41:11 +00:00 committed by Gitee
commit 9932e821d3
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 50 additions and 1 deletions

View File

@ -0,0 +1,41 @@
From 1a2836f9dcd00d8666acf33cbbf0ba58c821676b Mon Sep 17 00:00:00 2001
From: d00573793 <dingguangya1@huawei.com>
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<PlaceholderOp>(builder.getUnknownLoc(), 0, IDefineCode::UNDEF, 0, rPluginType);
mlir::Value name = TreeToValue((uint64_t)DECL_NAME(t));
llvm::Optional<uint64_t> 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

View File

@ -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 <dingguangya1@huawei.com> - 0.4.1-6
- Type:Update
- ID:NA
- SUG:NA
- DESC:Fix TreeToValue-VAR_DECL and ARRAY_TYPE-getDomainIndex
* Fri Mar 17 2023 dingguangya <dingguangya1@huawei.com> - 0.4.1-5
- Type:Update
- ID:NA