[PATCH] D66860: [ValueMapper] NFC: Remove dead code to pause metadata mapping

Pirama Arumuga Nainar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 28 10:42:44 PDT 2019


This revision was automatically updated to reflect the committed changes.
Closed by commit rL370236: [ValueMapper] NFC: Remove dead code to pause metadata mapping (authored by pirama, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D66860?vs=217568&id=217684#toc

Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D66860/new/

https://reviews.llvm.org/D66860

Files:
  llvm/trunk/include/llvm/IR/ValueMap.h
  llvm/trunk/lib/Transforms/Utils/ValueMapper.cpp


Index: llvm/trunk/include/llvm/IR/ValueMap.h
===================================================================
--- llvm/trunk/include/llvm/IR/ValueMap.h
+++ llvm/trunk/include/llvm/IR/ValueMap.h
@@ -93,7 +93,6 @@
   MapT Map;
   Optional<MDMapT> MDMap;
   ExtraData Data;
-  bool MayMapMetadata = true;
 
 public:
   using key_type = KeyT;
@@ -120,10 +119,6 @@
   }
   Optional<MDMapT> &getMDMap() { return MDMap; }
 
-  bool mayMapMetadata() const { return MayMapMetadata; }
-  void enableMapMetadata() { MayMapMetadata = true; }
-  void disableMapMetadata() { MayMapMetadata = false; }
-
   /// Get the mapped metadata, if it's in the map.
   Optional<Metadata *> getMappedMD(const Metadata *MD) const {
     if (!MDMap)
Index: llvm/trunk/lib/Transforms/Utils/ValueMapper.cpp
===================================================================
--- llvm/trunk/lib/Transforms/Utils/ValueMapper.cpp
+++ llvm/trunk/lib/Transforms/Utils/ValueMapper.cpp
@@ -774,20 +774,6 @@
   return *getMappedOp(&FirstN);
 }
 
-namespace {
-
-struct MapMetadataDisabler {
-  ValueToValueMapTy &VM;
-
-  MapMetadataDisabler(ValueToValueMapTy &VM) : VM(VM) {
-    VM.disableMapMetadata();
-  }
-
-  ~MapMetadataDisabler() { VM.enableMapMetadata(); }
-};
-
-} // end anonymous namespace
-
 Optional<Metadata *> Mapper::mapSimpleMetadata(const Metadata *MD) {
   // If the value already exists in the map, use it.
   if (Optional<Metadata *> NewMD = getVM().getMappedMD(MD))
@@ -802,9 +788,6 @@
     return const_cast<Metadata *>(MD);
 
   if (auto *CMD = dyn_cast<ConstantAsMetadata>(MD)) {
-    // Disallow recursion into metadata mapping through mapValue.
-    MapMetadataDisabler MMD(getVM());
-
     // Don't memoize ConstantAsMetadata.  Instead of lasting until the
     // LLVMContext is destroyed, they can be deleted when the GlobalValue they
     // reference is destructed.  These aren't super common, so the extra


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D66860.217684.patch
Type: text/x-patch
Size: 1906 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190828/83c3cf6b/attachment.bin>


More information about the llvm-commits mailing list