From 7bcf44ee14947ad934d2d0702b80beffeb1dc05d Mon Sep 17 00:00:00 2001 From: Pirama Arumuga Nainar Date: Wed, 28 Aug 2019 17:43:14 +0000 Subject: [PATCH] [ValueMapper] NFC: Remove dead code to pause metadata mapping Summary: This functionality was added when Mapper::mapMetadata was recursive. It is no longer needed after r265456, which switched it to be iterative. Reviewers: dexonsmith, srhines Subscribers: hiraditya, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D66860 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@370236 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/IR/ValueMap.h | 5 ----- lib/Transforms/Utils/ValueMapper.cpp | 17 ----------------- 2 files changed, 22 deletions(-) diff --git a/include/llvm/IR/ValueMap.h b/include/llvm/IR/ValueMap.h index faa27039af1..fb5440d5efe 100644 --- a/include/llvm/IR/ValueMap.h +++ b/include/llvm/IR/ValueMap.h @@ -93,7 +93,6 @@ class ValueMap { MapT Map; Optional MDMap; ExtraData Data; - bool MayMapMetadata = true; public: using key_type = KeyT; @@ -120,10 +119,6 @@ public: } Optional &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 getMappedMD(const Metadata *MD) const { if (!MDMap) diff --git a/lib/Transforms/Utils/ValueMapper.cpp b/lib/Transforms/Utils/ValueMapper.cpp index 6aca0e417bb..da68d3713b4 100644 --- a/lib/Transforms/Utils/ValueMapper.cpp +++ b/lib/Transforms/Utils/ValueMapper.cpp @@ -774,20 +774,6 @@ Metadata *MDNodeMapper::mapTopLevelUniquedNode(const MDNode &FirstN) { return *getMappedOp(&FirstN); } -namespace { - -struct MapMetadataDisabler { - ValueToValueMapTy &VM; - - MapMetadataDisabler(ValueToValueMapTy &VM) : VM(VM) { - VM.disableMapMetadata(); - } - - ~MapMetadataDisabler() { VM.enableMapMetadata(); } -}; - -} // end anonymous namespace - Optional Mapper::mapSimpleMetadata(const Metadata *MD) { // If the value already exists in the map, use it. if (Optional NewMD = getVM().getMappedMD(MD)) @@ -802,9 +788,6 @@ Optional Mapper::mapSimpleMetadata(const Metadata *MD) { return const_cast(MD); if (auto *CMD = dyn_cast(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 -- 2.40.0