[llvm] [AssignmentTracking] Skip large types in redundant debug info pruning (PR #74329)

Orlando Cazalet-Hyams via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 11 03:32:45 PST 2023


================
@@ -2295,33 +2295,41 @@ removeRedundantDbgLocsUsingBackwardScan(const BasicBlock *BB,
       DebugAggregate Aggr =
           getAggregate(FnVarLocs.getVariable(RIt->VariableID));
       uint64_t SizeInBits = Aggr.first->getSizeInBits().value_or(0);
+      uint64_t SizeInBytes = divideCeil(SizeInBits, 8);
 
-      if (SizeInBits == 0) {
+      // Cutoff for large variables to prevent expensive bitvector operations.
+      const uint64_t MaxSizeBytes = 2048;
+
+      if (SizeInBytes == 0 || SizeInBytes > MaxSizeBytes) {
         // If the size is unknown (0) then keep this location def to be safe.
+        // Do the same for defs of large variables, which would be expensive
+        // to represent with a BitVector.
+        // FIXME: Don't use a BitVector.
----------------
OCHyams wrote:

No I suppose not. I was thinking it'd be good to replace it with some custom interval map (one with properties that make using it worth it here), but that's a hypothetical data structure for which we don't know the performance characteristics. More investigation would be required - it's not clear that the solution in this patch would be better or worse, so I'll remove the comment.

https://github.com/llvm/llvm-project/pull/74329


More information about the llvm-commits mailing list