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

Stephen Tozer via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 11 03:27:14 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.
----------------
SLTozer wrote:

Is there a reason to not use a BitVector here, given that as discussed we don't lose correctness, and for the vast majority of cases we are well below this limit?

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


More information about the llvm-commits mailing list