[PATCH] D49039: [BitcodeReader] Infer the correct runtime preemption for GlobalValue
Steven Wu via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Jul 9 09:57:11 PDT 2018
This revision was automatically updated to reflect the committed changes.
Closed by commit rL336560: [BitcodeReader] Infer the correct runtime preemption for GlobalValue (authored by steven_wu, committed by ).
Repository:
rL LLVM
https://reviews.llvm.org/D49039
Files:
llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp
llvm/trunk/test/Bitcode/Inputs/infer_dso_local.bc
llvm/trunk/test/Bitcode/infer_dso_local.ll
Index: llvm/trunk/test/Bitcode/infer_dso_local.ll
===================================================================
--- llvm/trunk/test/Bitcode/infer_dso_local.ll
+++ llvm/trunk/test/Bitcode/infer_dso_local.ll
@@ -0,0 +1,3 @@
+; RUN: opt -verify %S/Inputs/infer_dso_local.bc | llvm-dis | FileCheck %s
+
+; CHECK: define linkonce_odr hidden void @test()
Index: llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp
===================================================================
--- llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp
+++ llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp
@@ -2831,6 +2831,13 @@
return Error::success();
}
+static void inferDSOLocal(GlobalValue *GV) {
+ // infer dso_local from linkage and visibility if it is not encoded.
+ if (GV->hasLocalLinkage() ||
+ (!GV->hasDefaultVisibility() && !GV->hasExternalWeakLinkage()))
+ GV->setDSOLocal(true);
+}
+
Error BitcodeReader::parseGlobalVarRecord(ArrayRef<uint64_t> Record) {
// v1: [pointer type, isconst, initid, linkage, alignment, section,
// visibility, threadlocal, unnamed_addr, externally_initialized,
@@ -2923,6 +2930,7 @@
if (Record.size() > 13) {
NewGV->setDSOLocal(getDecodedDSOLocal(Record[13]));
}
+ inferDSOLocal(NewGV);
return Error::success();
}
@@ -3007,6 +3015,7 @@
if (Record.size() > 15) {
Func->setDSOLocal(getDecodedDSOLocal(Record[15]));
}
+ inferDSOLocal(Func);
ValueList.push_back(Func);
@@ -3083,6 +3092,8 @@
}
if (OpNum != Record.size())
NewGA->setDSOLocal(getDecodedDSOLocal(Record[OpNum++]));
+ inferDSOLocal(NewGA);
+
ValueList.push_back(NewGA);
IndirectSymbolInits.push_back(std::make_pair(NewGA, Val));
return Error::success();
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D49039.154629.patch
Type: text/x-patch
Size: 1713 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180709/ff1f4913/attachment.bin>
More information about the llvm-commits
mailing list