summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms
diff options
context:
space:
mode:
authorTeresa Johnson <tejohnson@google.com>2019-12-03 12:22:51 -0800
committerTeresa Johnson <tejohnson@google.com>2019-12-04 14:59:27 -0800
commite420c0c78eb0700989c8ba80e845b6306d66bb5f (patch)
tree438fb1e7f1b2766db2e3373f1071f918ec4b3b5d /llvm/lib/Transforms
parent33f6d465d790ac5c9b949e6bc05127d356212079 (diff)
downloadbcm5719-llvm-e420c0c78eb0700989c8ba80e845b6306d66bb5f.tar.gz
bcm5719-llvm-e420c0c78eb0700989c8ba80e845b6306d66bb5f.zip
[ThinLTO] Fix importing of writeonly variables in distributed ThinLTO
Summary: D69561/dde5893 enabled importing of readonly variables with references, however, it introduced a bug relating to importing/internalization of writeonly variables with references. A fix for this was added in D70006/7f92d66. But this didn't work in distributed ThinLTO mode. The reason is that the fix (importing the writeonly var with a zeroinitializer) was only applied when there were references on the writeonly var summary. In distributed ThinLTO mode, where we only have a small slice of the index, we will not have the references on the importing side if we are not importing those referenced values. Rather than changing this handshaking (which will require a lot of other changes, since that's how we know what to import in the distributed backend clang invocation), we can simply always give the writeonly variable a zero initializer. Reviewers: evgeny777, steven_wu Subscribers: mehdi_amini, inglorion, hiraditya, dexonsmith, arphaman, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D70977
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r--llvm/lib/Transforms/Utils/FunctionImportUtils.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/llvm/lib/Transforms/Utils/FunctionImportUtils.cpp b/llvm/lib/Transforms/Utils/FunctionImportUtils.cpp
index 71aa585dfe5..26d48ee0d23 100644
--- a/llvm/lib/Transforms/Utils/FunctionImportUtils.cpp
+++ b/llvm/lib/Transforms/Utils/FunctionImportUtils.cpp
@@ -258,7 +258,7 @@ void FunctionImportGlobalProcessing::processGlobalForThinLTO(GlobalValue &GV) {
// references in IR module (not in combined index), so we can
// ignore them when computing import. We do not export references
// of writeonly object. See computeImportForReferencedGlobals
- if (ImportIndex.isWriteOnly(GVS) && GVS->refs().size())
+ if (ImportIndex.isWriteOnly(GVS))
V->setInitializer(Constant::getNullValue(V->getValueType()));
}
}
OpenPOWER on IntegriCloud