aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Bitcode
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/Bitcode')
-rw-r--r--llvm/lib/Bitcode/Reader/BitcodeAnalyzer.cpp1
-rw-r--r--llvm/lib/Bitcode/Reader/BitcodeReader.cpp14
-rw-r--r--llvm/lib/Bitcode/Writer/BitcodeWriter.cpp4
3 files changed, 19 insertions, 0 deletions
diff --git a/llvm/lib/Bitcode/Reader/BitcodeAnalyzer.cpp b/llvm/lib/Bitcode/Reader/BitcodeAnalyzer.cpp
index e91af12..a96e682 100644
--- a/llvm/lib/Bitcode/Reader/BitcodeAnalyzer.cpp
+++ b/llvm/lib/Bitcode/Reader/BitcodeAnalyzer.cpp
@@ -218,6 +218,7 @@ static Optional<const char *> GetCodeName(unsigned CodeID, unsigned BlockID,
STRINGIFY_CODE(CST_CODE, INLINEASM)
STRINGIFY_CODE(CST_CODE, CE_SHUFVEC_EX)
STRINGIFY_CODE(CST_CODE, CE_UNOP)
+ STRINGIFY_CODE(CST_CODE, DSO_LOCAL_EQUIVALENT)
case bitc::CST_CODE_BLOCKADDRESS:
return "CST_CODE_BLOCKADDRESS";
STRINGIFY_CODE(CST_CODE, DATA)
diff --git a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
index f88c371..fd24329 100644
--- a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
+++ b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
@@ -2888,6 +2888,20 @@ Error BitcodeReader::parseConstants() {
V = BlockAddress::get(Fn, BB);
break;
}
+ case bitc::CST_CODE_DSO_LOCAL_EQUIVALENT: {
+ if (Record.size() < 2)
+ return error("Invalid record");
+ Type *GVTy = getTypeByID(Record[0]);
+ if (!GVTy)
+ return error("Invalid record");
+ GlobalValue *GV = dyn_cast_or_null<GlobalValue>(
+ ValueList.getConstantFwdRef(Record[1], GVTy));
+ if (!GV)
+ return error("Invalid record");
+
+ V = DSOLocalEquivalent::get(GV);
+ break;
+ }
}
assert(V->getType() == flattenPointerTypes(CurFullTy) &&
diff --git a/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp b/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
index 9a4f724..c555b67 100644
--- a/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
+++ b/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
@@ -2609,6 +2609,10 @@ void ModuleBitcodeWriter::writeConstants(unsigned FirstVal, unsigned LastVal,
Record.push_back(VE.getTypeID(BA->getFunction()->getType()));
Record.push_back(VE.getValueID(BA->getFunction()));
Record.push_back(VE.getGlobalBasicBlockID(BA->getBasicBlock()));
+ } else if (const auto *Equiv = dyn_cast<DSOLocalEquivalent>(C)) {
+ Code = bitc::CST_CODE_DSO_LOCAL_EQUIVALENT;
+ Record.push_back(VE.getTypeID(Equiv->getGlobalValue()->getType()));
+ Record.push_back(VE.getValueID(Equiv->getGlobalValue()));
} else {
#ifndef NDEBUG
C->dump();