[llvm] r265282 - ValueMapper: Remove old FIXMEs; almost NFC

Duncan P. N. Exon Smith via llvm-commits llvm-commits at lists.llvm.org
Sun Apr 3 21:59:57 PDT 2016


Author: dexonsmith
Date: Sun Apr  3 23:59:56 2016
New Revision: 265282

URL: http://llvm.org/viewvc/llvm-project?rev=265282&view=rev
Log:
ValueMapper: Remove old FIXMEs; almost NFC

Remove a few old FIXMEs from the original commit of the Metadata/Value
split in r223802.  These are commented out assertions to the effect that
calls between mapValue and mapMetadata never return nullptr.

(The only behaviour change is that Mapper::mapSimpleMetadata memoizes
the nullptr return.)

When I originally rewrote the mapping code, I thought we could be
stricter in the new metadata hierarchy and never return nullptr when
RF_NullMapMissingGlobalValues was off.  It's still not entirely clear to
me why these assertions failed (a few months ago, I had a theory that I
forgot to write down, but that's helping no one).

Understood or not, I no longer see how these commented-out assertions
would be useful.  I'm relegating them to the annals of source control
before making significant changes to ValueMapper.cpp.

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=265282&r1=265281&r2=265282&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Utils/ValueMapper.cpp (original)
+++ llvm/trunk/lib/Transforms/Utils/ValueMapper.cpp Sun Apr  3 23:59:56 2016
@@ -185,12 +185,6 @@ Value *Mapper::mapValue(const Value *V)
     if (MD == MappedMD || (!MappedMD && (Flags & RF_IgnoreMissingEntries)))
       return VM[V] = const_cast<Value *>(V);
 
-    // FIXME: This assert crashes during bootstrap, but I think it should be
-    // correct.  For now, just match behaviour from before the metadata/value
-    // split.
-    //
-    //    assert((MappedMD || (Flags & RF_NullMapMissingGlobalValues)) &&
-    //           "Referenced metadata value not in value map");
     return VM[V] = MetadataAsValue::get(V->getContext(), MappedMD);
   }
 
@@ -296,12 +290,6 @@ Metadata *Mapper::mapMetadataOp(Metadata
   if (Flags & RF_IgnoreMissingEntries)
     return Op;
 
-  // FIXME: This assert crashes during bootstrap, but I think it should be
-  // correct.  For now, just match behaviour from before the metadata/value
-  // split.
-  //
-  //    assert((Flags & RF_NullMapMissingGlobalValues) &&
-  //           "Referenced metadata not in value map!");
   return nullptr;
 }
 
@@ -388,15 +376,7 @@ Optional<Metadata *> Mapper::mapSimpleMe
         (!MappedV && (Flags & RF_IgnoreMissingEntries)))
       return mapToSelf(MD);
 
-    // FIXME: This assert crashes during bootstrap, but I think it should be
-    // correct.  For now, just match behaviour from before the metadata/value
-    // split.
-    //
-    //    assert((MappedV || (Flags & RF_NullMapMissingGlobalValues)) &&
-    //           "Referenced metadata not in value map!");
-    if (MappedV)
-      return mapToMetadata(MD, ValueAsMetadata::get(MappedV));
-    return nullptr;
+    return mapToMetadata(MD, MappedV ? ValueAsMetadata::get(MappedV) : nullptr);
   }
 
   assert(isa<MDNode>(MD) && "Expected a metadata node");




More information about the llvm-commits mailing list