aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/AssignmentTrackingAnalysis.cpp
diff options
context:
space:
mode:
authorOCHyams <orlando.hyams@sony.com>2023-03-29 13:13:45 +0100
committerOCHyams <orlando.hyams@sony.com>2023-03-29 13:22:53 +0100
commitcbfeec668bb338cbc46107f568e867d53e242bd9 (patch)
tree39ddc501bdc203524ec6bca89d2a45ea94511014 /llvm/lib/CodeGen/AssignmentTrackingAnalysis.cpp
parente2b7424d06663f92b958c0b4649ed08b55216a49 (diff)
downloadllvm-cbfeec668bb338cbc46107f568e867d53e242bd9.zip
llvm-cbfeec668bb338cbc46107f568e867d53e242bd9.tar.gz
llvm-cbfeec668bb338cbc46107f568e867d53e242bd9.tar.bz2
[Assignment Tracking][NFC] Reduce work done in fragment overlap calculation
Only calculate fragment overlaps for partially stack homed variables. This filter is already applied to the rest of the analysis - this change simply prevents some unnecessary work. Reviewed By: jmorse Differential Revision: https://reviews.llvm.org/D145515
Diffstat (limited to 'llvm/lib/CodeGen/AssignmentTrackingAnalysis.cpp')
-rw-r--r--llvm/lib/CodeGen/AssignmentTrackingAnalysis.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/llvm/lib/CodeGen/AssignmentTrackingAnalysis.cpp b/llvm/lib/CodeGen/AssignmentTrackingAnalysis.cpp
index e438241..4a4e537 100644
--- a/llvm/lib/CodeGen/AssignmentTrackingAnalysis.cpp
+++ b/llvm/lib/CodeGen/AssignmentTrackingAnalysis.cpp
@@ -1851,6 +1851,7 @@ getUntaggedStoreAssignmentInfo(const Instruction &I, const DataLayout &Layout) {
/// to iterate over the function as they can be achieved together in one pass.
static AssignmentTrackingLowering::OverlapMap buildOverlapMapAndRecordDeclares(
Function &Fn, FunctionVarLocsBuilder *FnVarLocs,
+ const DenseSet<DebugAggregate> &VarsWithStackSlot,
AssignmentTrackingLowering::UntaggedStoreAssignmentMap &UntaggedStoreVars,
unsigned &TrackedVariablesVectorSize) {
DenseSet<DebugVariable> Seen;
@@ -1871,6 +1872,8 @@ static AssignmentTrackingLowering::OverlapMap buildOverlapMapAndRecordDeclares(
} else if (auto *DII = dyn_cast<DbgVariableIntrinsic>(&I)) {
DebugVariable DV = DebugVariable(DII);
DebugAggregate DA = {DV.getVariable(), DV.getInlinedAt()};
+ if (!VarsWithStackSlot.contains(DA))
+ continue;
if (Seen.insert(DV).second)
FragmentMap[DA].push_back(DV);
} else if (auto Info = getUntaggedStoreAssignmentInfo(
@@ -1895,6 +1898,8 @@ static AssignmentTrackingLowering::OverlapMap buildOverlapMapAndRecordDeclares(
DebugVariable DV = DebugVariable(DAI->getVariable(), FragInfo,
DAI->getDebugLoc().getInlinedAt());
DebugAggregate DA = {DV.getVariable(), DV.getInlinedAt()};
+ if (!VarsWithStackSlot.contains(DA))
+ continue;
// Cache this info for later.
UntaggedStoreVars[&I].push_back(
@@ -1972,7 +1977,8 @@ bool AssignmentTrackingLowering::run(FunctionVarLocsBuilder *FnVarLocsBuilder) {
// neither does LiveDebugVariables) because that is difficult to do and
// appears to be rare occurance.
VarContains = buildOverlapMapAndRecordDeclares(
- Fn, FnVarLocs, UntaggedStoreVars, TrackedVariablesVectorSize);
+ Fn, FnVarLocs, *VarsWithStackSlot, UntaggedStoreVars,
+ TrackedVariablesVectorSize);
// Prepare for traversal.
ReversePostOrderTraversal<Function *> RPOT(&Fn);