aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Transforms/Utils/LoopRotationUtils.cpp
diff options
context:
space:
mode:
authorStephen Tozer <stephen.tozer@sony.com>2024-03-19 20:07:07 +0000
committerGitHub <noreply@github.com>2024-03-19 20:07:07 +0000
commitffd08c7759000f55332f1657a1fab64a7adc03fd (patch)
treeffc35f7afc77e9aa3ff89031c72a9ec8e7321b2b /llvm/lib/Transforms/Utils/LoopRotationUtils.cpp
parent3cd9dccbb4235e057d0e53ab0b9673f3766800d4 (diff)
downloadllvm-ffd08c7759000f55332f1657a1fab64a7adc03fd.zip
llvm-ffd08c7759000f55332f1657a1fab64a7adc03fd.tar.gz
llvm-ffd08c7759000f55332f1657a1fab64a7adc03fd.tar.bz2
[RemoveDIs][NFC] Rename DPValue -> DbgVariableRecord (#85216)
This is the major rename patch that prior patches have built towards. The DPValue class is being renamed to DbgVariableRecord, which reflects the updated terminology for the "final" implementation of the RemoveDI feature. This is a pure string substitution + clang-format patch. The only manual component of this patch was determining where to perform these string substitutions: `DPValue` and `DPV` are almost exclusively used for DbgRecords, *except* for: - llvm/lib/target, where 'DP' is used to mean double-precision, and so appears as part of .td files and in variable names. NB: There is a single existing use of `DPValue` here that refers to debug info, which I've manually updated. - llvm/tools/gold, where 'LDPV' is used as a prefix for symbol visibility enums. Outside of these places, I've applied several basic string substitutions, with the intent that they only affect DbgRecord-related identifiers; I've checked them as I went through to verify this, with reasonable confidence that there are no unintended changes that slipped through the cracks. The substitutions applied are all case-sensitive, and are applied in the order shown: ``` DPValue -> DbgVariableRecord DPVal -> DbgVarRec DPV -> DVR ``` Following the previous rename patches, it should be the case that there are no instances of any of these strings that are meant to refer to the general case of DbgRecords, or anything other than the DPValue class. The idea behind this patch is therefore that pure string substitution is correct in all cases as long as these assumptions hold.
Diffstat (limited to 'llvm/lib/Transforms/Utils/LoopRotationUtils.cpp')
-rw-r--r--llvm/lib/Transforms/Utils/LoopRotationUtils.cpp53
1 files changed, 29 insertions, 24 deletions
diff --git a/llvm/lib/Transforms/Utils/LoopRotationUtils.cpp b/llvm/lib/Transforms/Utils/LoopRotationUtils.cpp
index 980ecf0..4470c5a 100644
--- a/llvm/lib/Transforms/Utils/LoopRotationUtils.cpp
+++ b/llvm/lib/Transforms/Utils/LoopRotationUtils.cpp
@@ -159,8 +159,8 @@ static void RewriteUsesOfClonedInstructions(BasicBlock *OrigHeader,
// Replace MetadataAsValue(ValueAsMetadata(OrigHeaderVal)) uses in debug
// intrinsics.
SmallVector<DbgValueInst *, 1> DbgValues;
- SmallVector<DPValue *, 1> DPValues;
- llvm::findDbgValues(DbgValues, OrigHeaderVal, &DPValues);
+ SmallVector<DbgVariableRecord *, 1> DbgVariableRecords;
+ llvm::findDbgValues(DbgValues, OrigHeaderVal, &DbgVariableRecords);
for (auto &DbgValue : DbgValues) {
// The original users in the OrigHeader are already using the original
// definitions.
@@ -183,11 +183,11 @@ static void RewriteUsesOfClonedInstructions(BasicBlock *OrigHeader,
}
// RemoveDIs: duplicate implementation for non-instruction debug-info
- // storage in DPValues.
- for (DPValue *DPV : DPValues) {
+ // storage in DbgVariableRecords.
+ for (DbgVariableRecord *DVR : DbgVariableRecords) {
// The original users in the OrigHeader are already using the original
// definitions.
- BasicBlock *UserBB = DPV->getMarker()->getParent();
+ BasicBlock *UserBB = DVR->getMarker()->getParent();
if (UserBB == OrigHeader)
continue;
@@ -202,7 +202,7 @@ static void RewriteUsesOfClonedInstructions(BasicBlock *OrigHeader,
NewVal = SSA.GetValueInMiddleOfBlock(UserBB);
else
NewVal = UndefValue::get(OrigHeaderVal->getType());
- DPV->replaceVariableLocationOp(OrigHeaderVal, NewVal);
+ DVR->replaceVariableLocationOp(OrigHeaderVal, NewVal);
}
}
}
@@ -552,20 +552,22 @@ bool LoopRotate::rotateLoop(Loop *L, bool SimplifiedLatch) {
for (Instruction &I : llvm::drop_begin(llvm::reverse(*OrigPreheader))) {
if (auto *DII = dyn_cast<DbgVariableIntrinsic>(&I)) {
DbgIntrinsics.insert(makeHash(DII));
- // Until RemoveDIs supports dbg.declares in DPValue format, we'll need
- // to collect DPValues attached to any other debug intrinsics.
- for (const DPValue &DPV : filterDbgVars(DII->getDbgRecordRange()))
- DbgIntrinsics.insert(makeHash(&DPV));
+ // Until RemoveDIs supports dbg.declares in DbgVariableRecord format,
+ // we'll need to collect DbgVariableRecords attached to any other debug
+ // intrinsics.
+ for (const DbgVariableRecord &DVR :
+ filterDbgVars(DII->getDbgRecordRange()))
+ DbgIntrinsics.insert(makeHash(&DVR));
} else {
break;
}
}
- // Build DPValue hashes for DPValues attached to the terminator, which isn't
- // considered in the loop above.
- for (const DPValue &DPV :
+ // Build DbgVariableRecord hashes for DbgVariableRecords attached to the
+ // terminator, which isn't considered in the loop above.
+ for (const DbgVariableRecord &DVR :
filterDbgVars(OrigPreheader->getTerminator()->getDbgRecordRange()))
- DbgIntrinsics.insert(makeHash(&DPV));
+ DbgIntrinsics.insert(makeHash(&DVR));
// Remember the local noalias scope declarations in the header. After the
// rotation, they must be duplicated and the scope must be cloned. This
@@ -627,13 +629,14 @@ bool LoopRotate::rotateLoop(Loop *L, bool SimplifiedLatch) {
!NextDbgInsts.empty()) {
auto DbgValueRange =
LoopEntryBranch->cloneDebugInfoFrom(Inst, NextDbgInsts.begin());
- RemapDPValueRange(M, DbgValueRange, ValueMap,
- RF_NoModuleLevelChanges | RF_IgnoreMissingLocals);
+ RemapDbgVariableRecordRange(M, DbgValueRange, ValueMap,
+ RF_NoModuleLevelChanges |
+ RF_IgnoreMissingLocals);
// Erase anything we've seen before.
- for (DPValue &DPV :
+ for (DbgVariableRecord &DVR :
make_early_inc_range(filterDbgVars(DbgValueRange)))
- if (DbgIntrinsics.count(makeHash(&DPV)))
- DPV.eraseFromParent();
+ if (DbgIntrinsics.count(makeHash(&DVR)))
+ DVR.eraseFromParent();
}
NextDbgInsts = I->getDbgRecordRange();
@@ -653,13 +656,15 @@ bool LoopRotate::rotateLoop(Loop *L, bool SimplifiedLatch) {
if (LoopEntryBranch->getParent()->IsNewDbgInfoFormat &&
!NextDbgInsts.empty()) {
auto Range = C->cloneDebugInfoFrom(Inst, NextDbgInsts.begin());
- RemapDPValueRange(M, Range, ValueMap,
- RF_NoModuleLevelChanges | RF_IgnoreMissingLocals);
+ RemapDbgVariableRecordRange(M, Range, ValueMap,
+ RF_NoModuleLevelChanges |
+ RF_IgnoreMissingLocals);
NextDbgInsts = DPMarker::getEmptyDbgRecordRange();
// Erase anything we've seen before.
- for (DPValue &DPV : make_early_inc_range(filterDbgVars(Range)))
- if (DbgIntrinsics.count(makeHash(&DPV)))
- DPV.eraseFromParent();
+ for (DbgVariableRecord &DVR :
+ make_early_inc_range(filterDbgVars(Range)))
+ if (DbgIntrinsics.count(makeHash(&DVR)))
+ DVR.eraseFromParent();
}
// Eagerly remap the operands of the instruction.