diff options
author | Duncan P. N. Exon Smith <dexonsmith@apple.com> | 2015-03-17 01:14:40 +0000 |
---|---|---|
committer | Duncan P. N. Exon Smith <dexonsmith@apple.com> | 2015-03-17 01:14:40 +0000 |
commit | 170c26d75eb1fb0e8c3c0ae7107ab971bc61e64b (patch) | |
tree | dc324d79cff8b93f1c7e468583060761ad7a2b92 /llvm/lib/Transforms | |
parent | cc6b381651f23b572db15b8bf9df4bcff62edc57 (diff) | |
download | bcm5719-llvm-170c26d75eb1fb0e8c3c0ae7107ab971bc61e64b.tar.gz bcm5719-llvm-170c26d75eb1fb0e8c3c0ae7107ab971bc61e64b.zip |
MapMetadata: Allow unresolved metadata if it won't change
Allow unresolved nodes through the `MapMetadata()` if
`RF_NoModuleLevelChanges`, since there's no remapping to do anyway.
This fixes PR22929. I'll add a clang test as a follow-up.
llvm-svn: 232449
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r-- | llvm/lib/Transforms/Utils/ValueMapper.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/llvm/lib/Transforms/Utils/ValueMapper.cpp b/llvm/lib/Transforms/Utils/ValueMapper.cpp index 49c0902addb..54c76887234 100644 --- a/llvm/lib/Transforms/Utils/ValueMapper.cpp +++ b/llvm/lib/Transforms/Utils/ValueMapper.cpp @@ -291,14 +291,18 @@ static Metadata *MapMetadataImpl(const Metadata *MD, return nullptr; } + // Note: this cast precedes the Flags check so we always get its associated + // assertion. const MDNode *Node = cast<MDNode>(MD); - assert(Node->isResolved() && "Unexpected unresolved node"); // If this is a module-level metadata and we know that nothing at the // module level is changing, then use an identity mapping. if (Flags & RF_NoModuleLevelChanges) return mapToSelf(VM, MD); + // Require resolved nodes whenever metadata might be remapped. + assert(Node->isResolved() && "Unexpected unresolved node"); + if (Node->isDistinct()) return mapDistinctNode(Node, Cycles, VM, Flags, TypeMapper, Materializer); |