diff options
Diffstat (limited to 'llvm/lib/Transforms/Utils/ValueMapper.cpp')
-rw-r--r-- | llvm/lib/Transforms/Utils/ValueMapper.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/Utils/ValueMapper.cpp b/llvm/lib/Transforms/Utils/ValueMapper.cpp index d0ec368..46ba2e7 100644 --- a/llvm/lib/Transforms/Utils/ValueMapper.cpp +++ b/llvm/lib/Transforms/Utils/ValueMapper.cpp @@ -432,6 +432,20 @@ Value *Mapper::mapValue(const Value *V) { if (BlockAddress *BA = dyn_cast<BlockAddress>(C)) return mapBlockAddress(*BA); + if (const auto *E = dyn_cast<DSOLocalEquivalent>(C)) { + auto *Val = mapValue(E->getGlobalValue()); + GlobalValue *GV = dyn_cast<GlobalValue>(Val); + if (GV) + return getVM()[E] = DSOLocalEquivalent::get(GV); + + auto *Func = cast<Function>(Val->stripPointerCastsAndAliases()); + Type *NewTy = E->getType(); + if (TypeMapper) + NewTy = TypeMapper->remapType(NewTy); + return getVM()[E] = llvm::ConstantExpr::getBitCast( + DSOLocalEquivalent::get(Func), NewTy); + } + auto mapValueOrNull = [this](Value *V) { auto Mapped = mapValue(V); assert((Mapped || (Flags & RF_NullMapMissingGlobalValues)) && |