forked from OSchip/llvm-project
[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:
parent
b88ea354fe
commit
96f7f81aa3
|
@ -915,11 +915,11 @@ public:
|
||||||
/// \brief Resolve cycles.
|
/// \brief Resolve cycles.
|
||||||
///
|
///
|
||||||
/// Once all forward declarations have been resolved, force cycles to be
|
/// 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.
|
/// is ignored, otherwise it asserts when encountering temporary metadata.
|
||||||
///
|
///
|
||||||
/// \pre No operands (or operands' operands, etc.) have \a isTemporary().
|
/// \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.
|
/// \brief Replace a temporary node with a permanent one.
|
||||||
///
|
///
|
||||||
|
|
|
@ -557,7 +557,7 @@ void MDNode::decrementUnresolvedOperandCount() {
|
||||||
resolve();
|
resolve();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MDNode::resolveCycles(bool MDMaterialized) {
|
void MDNode::resolveCycles(bool AllowTemps) {
|
||||||
if (isResolved())
|
if (isResolved())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -570,7 +570,7 @@ void MDNode::resolveCycles(bool MDMaterialized) {
|
||||||
if (!N)
|
if (!N)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (N->isTemporary() && !MDMaterialized)
|
if (N->isTemporary() && AllowTemps)
|
||||||
continue;
|
continue;
|
||||||
assert(!N->isTemporary() &&
|
assert(!N->isTemporary() &&
|
||||||
"Expected all forward declarations to be resolved");
|
"Expected all forward declarations to be resolved");
|
||||||
|
|
|
@ -1128,7 +1128,8 @@ bool IRLinker::linkFunctionBody(Function &Dst, Function &Src) {
|
||||||
// a function and before remapping metadata on instructions below
|
// a function and before remapping metadata on instructions below
|
||||||
// in RemapInstruction, as the saved mapping is used to handle
|
// in RemapInstruction, as the saved mapping is used to handle
|
||||||
// the temporary metadata hanging off instructions.
|
// the temporary metadata hanging off instructions.
|
||||||
SrcM.getMaterializer()->saveMetadataList(MetadataToIDs, true);
|
SrcM.getMaterializer()->saveMetadataList(MetadataToIDs,
|
||||||
|
/* OnlyTempMD = */ true);
|
||||||
|
|
||||||
// Link in the prefix data.
|
// Link in the prefix data.
|
||||||
if (Src.hasPrefixData())
|
if (Src.hasPrefixData())
|
||||||
|
@ -1531,7 +1532,8 @@ bool IRLinker::run() {
|
||||||
// Ensure metadata materialized
|
// Ensure metadata materialized
|
||||||
if (SrcM.getMaterializer()->materializeMetadata())
|
if (SrcM.getMaterializer()->materializeMetadata())
|
||||||
return true;
|
return true;
|
||||||
SrcM.getMaterializer()->saveMetadataList(MetadataToIDs, false);
|
SrcM.getMaterializer()->saveMetadataList(MetadataToIDs,
|
||||||
|
/* OnlyTempMD = */ false);
|
||||||
}
|
}
|
||||||
|
|
||||||
linkNamedMDNodes();
|
linkNamedMDNodes();
|
||||||
|
|
|
@ -218,12 +218,12 @@ static Metadata *mapMetadataOp(Metadata *Op,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Resolve uniquing cycles involving the given metadata.
|
/// 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 (auto *N = dyn_cast_or_null<MDNode>(MD)) {
|
||||||
if (!MDMaterialized && N->isTemporary())
|
if (AllowTemps && N->isTemporary())
|
||||||
return;
|
return;
|
||||||
if (!N->isResolved())
|
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
|
// Resolve uniquing cycles underneath distinct nodes on the fly so they
|
||||||
// don't infect later operands.
|
// don't infect later operands.
|
||||||
if (IsDistinct)
|
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;
|
return NewMD;
|
||||||
|
|
||||||
// Resolve cycles involving the entry metadata.
|
// Resolve cycles involving the entry metadata.
|
||||||
resolveCycles(NewMD, !(Flags & RF_HaveUnmaterializedMetadata));
|
resolveCycles(NewMD, Flags & RF_HaveUnmaterializedMetadata);
|
||||||
|
|
||||||
// Remap the operands of distinct MDNodes.
|
// Remap the operands of distinct MDNodes.
|
||||||
while (!DistinctWorklist.empty())
|
while (!DistinctWorklist.empty())
|
||||||
|
|
Loading…
Reference in New Issue