[PATCH] D145515: [Assignment Tracking][NFC] Only calculate fragment overlaps for partially stack homed variables

Orlando Cazalet-Hyams via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 15 04:10:54 PDT 2023


Orlando updated this revision to Diff 505435.
Orlando marked an inline comment as done.

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D145515/new/

https://reviews.llvm.org/D145515

Files:
  llvm/lib/CodeGen/AssignmentTrackingAnalysis.cpp


Index: llvm/lib/CodeGen/AssignmentTrackingAnalysis.cpp
===================================================================
--- llvm/lib/CodeGen/AssignmentTrackingAnalysis.cpp
+++ llvm/lib/CodeGen/AssignmentTrackingAnalysis.cpp
@@ -1840,7 +1840,8 @@
 /// These tasks are bundled together to reduce the number of times we need
 /// to iterate over the function as they can be achieved together in one pass.
 static AssignmentTrackingLowering::OverlapMap buildOverlapMapAndRecordDeclares(
-    Function &Fn, FunctionVarLocsBuilder *FnVarLocs,
+    Function &Fn, const DenseSet<DebugAggregate> &VarsWithStackSlot,
+    FunctionVarLocsBuilder *FnVarLocs,
     AssignmentTrackingLowering::UntaggedStoreAssignmentMap &UntaggedStoreVars) {
   DenseSet<DebugVariable> Seen;
   // Map of Variable: [Fragments].
@@ -1860,6 +1861,8 @@
       } 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(
@@ -1884,6 +1887,8 @@
           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(
@@ -1951,8 +1956,8 @@
   // Note that this pass doesn't handle partial overlaps correctly (FWIW
   // neither does LiveDebugVariables) because that is difficult to do and
   // appears to be rare occurance.
-  VarContains =
-      buildOverlapMapAndRecordDeclares(Fn, FnVarLocs, UntaggedStoreVars);
+  VarContains = buildOverlapMapAndRecordDeclares(Fn, *VarsWithStackSlot,
+                                                 FnVarLocs, UntaggedStoreVars);
 
   // Prepare for traversal.
   ReversePostOrderTraversal<Function *> RPOT(&Fn);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D145515.505435.patch
Type: text/x-patch
Size: 2156 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230315/bdd95b08/attachment.bin>


More information about the llvm-commits mailing list