ValueMapper: Unduplicate RF_NoModuleLevelChanges check, NFC

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265761 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Duncan P. N. Exon Smith 2016-04-08 00:41:10 +00:00
parent 11a3cfb7db
commit 86c8abfe54

View File

@ -651,10 +651,12 @@ Optional<Metadata *> Mapper::mapSimpleMetadata(const Metadata *MD) {
if (isa<MDString>(MD))
return mapToSelf(MD);
if (auto *CMD = dyn_cast<ConstantAsMetadata>(MD)) {
if ((Flags & RF_NoModuleLevelChanges))
return mapToSelf(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);
if (auto *CMD = dyn_cast<ConstantAsMetadata>(MD)) {
// Disallow recursion into metadata mapping through mapValue.
VM.disableMapMetadata();
Value *MappedV = mapValue(CMD->getValue());
@ -668,11 +670,6 @@ Optional<Metadata *> Mapper::mapSimpleMetadata(const Metadata *MD) {
assert(isa<MDNode>(MD) && "Expected a metadata 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(MD);
return None;
}