diff options
author | Leonard Chan <leonardchan@google.com> | 2021-02-10 10:48:22 -0800 |
---|---|---|
committer | Leonard Chan <leonardchan@google.com> | 2021-02-22 10:37:57 -0800 |
commit | 1c932baeaafbd4c9051ed4836f320db9003f4068 (patch) | |
tree | 9fd0ca7b15020d56b3c2dd138842ccbdb6a5d323 /llvm/lib/Bitcode/Reader | |
parent | 95d13c01ecba5c9dba8ea1bd875c4179cbaea9e2 (diff) | |
download | llvm-1c932baeaafbd4c9051ed4836f320db9003f4068.zip llvm-1c932baeaafbd4c9051ed4836f320db9003f4068.tar.gz llvm-1c932baeaafbd4c9051ed4836f320db9003f4068.tar.bz2 |
[llvm][Bitcode] Add bitcode reader/writer for DSOLocalEquivalent
This is necessary for compilation with [thin]lto.
Differential Revision: https://reviews.llvm.org/D96170
Diffstat (limited to 'llvm/lib/Bitcode/Reader')
-rw-r--r-- | llvm/lib/Bitcode/Reader/BitcodeAnalyzer.cpp | 1 | ||||
-rw-r--r-- | llvm/lib/Bitcode/Reader/BitcodeReader.cpp | 14 |
2 files changed, 15 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) && |