diff options
Diffstat (limited to 'lib/Transforms/Utils/ValueMapper.cpp')
-rw-r--r-- | lib/Transforms/Utils/ValueMapper.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/Transforms/Utils/ValueMapper.cpp b/lib/Transforms/Utils/ValueMapper.cpp index 484765a7e2..d79c21f474 100644 --- a/lib/Transforms/Utils/ValueMapper.cpp +++ b/lib/Transforms/Utils/ValueMapper.cpp @@ -13,6 +13,11 @@ Value *MapValue(const Value *V, std::map<const Value*, Value*> &VM) { Value *&VMSlot = VM[V]; if (VMSlot) return VMSlot; // Does it exist in the map yet? + // Global values do not need to be seeded into the ValueMap if they are using + // the identity mapping. + if (isa<GlobalValue>(V)) + return VMSlot = const_cast<Value*>(V); + if (Constant *C = const_cast<Constant*>(dyn_cast<Constant>(V))) { if (isa<ConstantIntegral>(C) || isa<ConstantFP>(C) || isa<ConstantPointerNull>(C)) |