[llvm] r265761 - ValueMapper: Unduplicate RF_NoModuleLevelChanges check, NFC

Duncan P. N. Exon Smith via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 7 17:41:10 PDT 2016


Author: dexonsmith
Date: Thu Apr  7 19:41:10 2016
New Revision: 265761

URL: http://llvm.org/viewvc/llvm-project?rev=265761&view=rev
Log:
ValueMapper: Unduplicate RF_NoModuleLevelChanges check, NFC

Modified:
    llvm/trunk/lib/Transforms/Utils/ValueMapper.cpp

Modified: llvm/trunk/lib/Transforms/Utils/ValueMapper.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/ValueMapper.cpp?rev=265761&r1=265760&r2=265761&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Utils/ValueMapper.cpp (original)
+++ llvm/trunk/lib/Transforms/Utils/ValueMapper.cpp Thu Apr  7 19:41:10 2016
@@ -651,10 +651,12 @@ Optional<Metadata *> Mapper::mapSimpleMe
   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::mapSimpleMe
 
   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;
 }
 




More information about the llvm-commits mailing list