aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Transforms/Utils/ValueMapper.cpp
diff options
context:
space:
mode:
authorDuncan P. N. Exon Smith <dexonsmith@apple.com>2016-04-08 18:49:36 +0000
committerDuncan P. N. Exon Smith <dexonsmith@apple.com>2016-04-08 18:49:36 +0000
commit69341e6abca92f7f118ee7bd99be0cdfc649386f (patch)
tree543c8c36236826e8d0a4eb9d8f7d2c8a08b8f1d1 /llvm/lib/Transforms/Utils/ValueMapper.cpp
parente05ff7c1a787cf2bf85e4c73947eea5df34ed8c3 (diff)
downloadllvm-69341e6abca92f7f118ee7bd99be0cdfc649386f.zip
llvm-69341e6abca92f7f118ee7bd99be0cdfc649386f.tar.gz
llvm-69341e6abca92f7f118ee7bd99be0cdfc649386f.tar.bz2
ValueMapper: Don't memoize metadata when RF_NoModuleLevelChanges
Prevent the Metadata side-table in ValueMap from growing unnecessarily when RF_NoModuleLevelChanges. As a drive-by, make ValueMap::hasMD, which apparently had no users until I used it here for testing, actually compile. llvm-svn: 265828
Diffstat (limited to 'llvm/lib/Transforms/Utils/ValueMapper.cpp')
-rw-r--r--llvm/lib/Transforms/Utils/ValueMapper.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/llvm/lib/Transforms/Utils/ValueMapper.cpp b/llvm/lib/Transforms/Utils/ValueMapper.cpp
index b18af19..472c2ca 100644
--- a/llvm/lib/Transforms/Utils/ValueMapper.cpp
+++ b/llvm/lib/Transforms/Utils/ValueMapper.cpp
@@ -658,7 +658,7 @@ Optional<Metadata *> Mapper::mapSimpleMetadata(const Metadata *MD) {
// This is a module-level metadata. If nothing at the module level is
// changing, use an identity mapping.
if ((Flags & RF_NoModuleLevelChanges))
- return mapToSelf(MD);
+ return const_cast<Metadata *>(MD);
if (auto *CMD = dyn_cast<ConstantAsMetadata>(MD)) {
// Disallow recursion into metadata mapping through mapValue.