aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
diff options
context:
space:
mode:
authorLeonard Chan <leonardchan@google.com>2021-02-10 10:48:22 -0800
committerLeonard Chan <leonardchan@google.com>2021-02-22 10:37:57 -0800
commit1c932baeaafbd4c9051ed4836f320db9003f4068 (patch)
tree9fd0ca7b15020d56b3c2dd138842ccbdb6a5d323 /llvm/lib/Bitcode/Reader/BitcodeReader.cpp
parent95d13c01ecba5c9dba8ea1bd875c4179cbaea9e2 (diff)
downloadllvm-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/BitcodeReader.cpp')
-rw-r--r--llvm/lib/Bitcode/Reader/BitcodeReader.cpp14
1 files changed, 14 insertions, 0 deletions
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) &&