[llvm][Bitcode] Add bitcode reader/writer for DSOLocalEquivalent

This is necessary for compilation with [thin]lto.

Differential Revision: https://reviews.llvm.org/D96170
This commit is contained in:
Leonard Chan
2021-02-10 10:48:22 -08:00
parent 95d13c01ec
commit 1c932baeaa
5 changed files with 108 additions and 2 deletions

View File

@@ -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) &&