[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.

llvm-svn: 256653
This commit is contained in:
Teresa Johnson 2015-12-30 21:13:55 +00:00
parent b88ea354fe
commit 96f7f81aa3
4 changed files with 13 additions and 11 deletions

View File

@ -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.
///

View File

@ -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");

View File

@ -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();

View File

@ -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<MDNode>(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())