From 04e678255f71d4a9ca731f57e46c723ad20a0117 Mon Sep 17 00:00:00 2001 From: Teresa Johnson Date: Wed, 30 Dec 2015 21:13:55 +0000 Subject: [PATCH] [ThinLTO] Rename variables used in metadata linking (NFC) As suggested in review for r255909, rename MDMaterialized to AllowTemps, and identify the name of the boolean flag being set in calls to saveMetadataList. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@256653 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/IR/Metadata.h | 4 ++-- lib/IR/Metadata.cpp | 4 ++-- lib/Linker/IRMover.cpp | 6 ++++-- lib/Transforms/Utils/ValueMapper.cpp | 10 +++++----- 4 files changed, 13 insertions(+), 11 deletions(-) diff --git a/include/llvm/IR/Metadata.h b/include/llvm/IR/Metadata.h index 0715229a875..4a8557d074f 100644 --- a/include/llvm/IR/Metadata.h +++ b/include/llvm/IR/Metadata.h @@ -915,11 +915,11 @@ public: /// \brief Resolve cycles. /// /// Once all forward declarations have been resolved, force cycles to be - /// resolved. If \p MDMaterialized is true, then any temporary metadata + /// resolved. If \p AllowTemps is true, then any temporary metadata /// is ignored, otherwise it asserts when encountering temporary metadata. /// /// \pre No operands (or operands' operands, etc.) have \a isTemporary(). - void resolveCycles(bool MDMaterialized = true); + void resolveCycles(bool AllowTemps = false); /// \brief Replace a temporary node with a permanent one. /// diff --git a/lib/IR/Metadata.cpp b/lib/IR/Metadata.cpp index f9543a65858..d8eaceb9ea2 100644 --- a/lib/IR/Metadata.cpp +++ b/lib/IR/Metadata.cpp @@ -557,7 +557,7 @@ void MDNode::decrementUnresolvedOperandCount() { resolve(); } -void MDNode::resolveCycles(bool MDMaterialized) { +void MDNode::resolveCycles(bool AllowTemps) { if (isResolved()) return; @@ -570,7 +570,7 @@ void MDNode::resolveCycles(bool MDMaterialized) { if (!N) continue; - if (N->isTemporary() && !MDMaterialized) + if (N->isTemporary() && AllowTemps) continue; assert(!N->isTemporary() && "Expected all forward declarations to be resolved"); diff --git a/lib/Linker/IRMover.cpp b/lib/Linker/IRMover.cpp index 2e09d78a690..309690f61d7 100644 --- a/lib/Linker/IRMover.cpp +++ b/lib/Linker/IRMover.cpp @@ -1128,7 +1128,8 @@ bool IRLinker::linkFunctionBody(Function &Dst, Function &Src) { // a function and before remapping metadata on instructions below // in RemapInstruction, as the saved mapping is used to handle // the temporary metadata hanging off instructions. - SrcM.getMaterializer()->saveMetadataList(MetadataToIDs, true); + SrcM.getMaterializer()->saveMetadataList(MetadataToIDs, + /* OnlyTempMD = */ true); // Link in the prefix data. if (Src.hasPrefixData()) @@ -1531,7 +1532,8 @@ bool IRLinker::run() { // Ensure metadata materialized if (SrcM.getMaterializer()->materializeMetadata()) return true; - SrcM.getMaterializer()->saveMetadataList(MetadataToIDs, false); + SrcM.getMaterializer()->saveMetadataList(MetadataToIDs, + /* OnlyTempMD = */ false); } linkNamedMDNodes(); diff --git a/lib/Transforms/Utils/ValueMapper.cpp b/lib/Transforms/Utils/ValueMapper.cpp index 1add78e0165..2e361d38ed0 100644 --- a/lib/Transforms/Utils/ValueMapper.cpp +++ b/lib/Transforms/Utils/ValueMapper.cpp @@ -218,12 +218,12 @@ static Metadata *mapMetadataOp(Metadata *Op, } /// Resolve uniquing cycles involving the given metadata. -static void resolveCycles(Metadata *MD, bool MDMaterialized) { +static void resolveCycles(Metadata *MD, bool AllowTemps) { if (auto *N = dyn_cast_or_null(MD)) { - if (!MDMaterialized && N->isTemporary()) + if (AllowTemps && N->isTemporary()) return; if (!N->isResolved()) - N->resolveCycles(MDMaterialized); + N->resolveCycles(AllowTemps); } } @@ -253,7 +253,7 @@ static bool remapOperands(MDNode &Node, // Resolve uniquing cycles underneath distinct nodes on the fly so they // don't infect later operands. if (IsDistinct) - resolveCycles(New, !(Flags & RF_HaveUnmaterializedMetadata)); + resolveCycles(New, Flags & RF_HaveUnmaterializedMetadata); } } @@ -401,7 +401,7 @@ Metadata *llvm::MapMetadata(const Metadata *MD, ValueToValueMapTy &VM, return NewMD; // Resolve cycles involving the entry metadata. - resolveCycles(NewMD, !(Flags & RF_HaveUnmaterializedMetadata)); + resolveCycles(NewMD, Flags & RF_HaveUnmaterializedMetadata); // Remap the operands of distinct MDNodes. while (!DistinctWorklist.empty()) -- 2.34.1