[llvm] Handle #dbg_values in SROA. (PR #94070)

Shubham Sandeep Rastogi via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 26 12:16:59 PDT 2024


rastogishubham wrote:

I also got the dwarfdump statistics for the binary before and after the patch:

Before the patch:
```
shubham at Mac-3004D6-3 build % dwarfdump /tmp/lto.o --statistics
{
  "version": 9,
  "file": "/tmp/lto.o",
  "format": "Mach-O arm64",
  "#functions": 7643,
  "#functions with location": 7604,
  "#inlined functions": 106782,
  "#inlined functions with abstract origins": 106782,
  "#unique source variables": 15569,
  "#source variables": 233531,
  "#source variables with location": 151078,
  "#call site entries": 106782,
  "#call site DIEs": 5501,
  "#call site parameter DIEs": 0,
  "sum_all_variables(#bytes in parent scope)": 19147628,
  "sum_all_variables(#bytes in any scope covered by DW_AT_location)": 16996240,
  "sum_all_variables(#bytes in parent scope covered by DW_AT_location)": 15709564,
  "sum_all_variables(#bytes in parent scope covered by DW_OP_entry_value)": 502224,
  "sum_all_params(#bytes in parent scope)": 14035592,
  "sum_all_params(#bytes in parent scope covered by DW_AT_location)": 11679276,
  "sum_all_params(#bytes in parent scope covered by DW_OP_entry_value)": 502224,
  "sum_all_local_vars(#bytes in parent scope)": 5112036,
  "sum_all_local_vars(#bytes in parent scope covered by DW_AT_location)": 4030288,
  "sum_all_local_vars(#bytes in parent scope covered by DW_OP_entry_value)": 0,
  "#bytes within functions": 658456,
  "#bytes within inlined functions": 615040,
  "#params": 84798,
  "#params with source location": 84798,
  "#params with type": 84798,
  "#params with binary location": 84707,
  "#local vars": 13365,
  "#local vars with source location": 13365,
  "#local vars with type": 13365,
  "#local vars with binary location": 13220,
  "#bytes in __debug_loc": 3104608,
  "#bytes in __debug_abbrev": 3994,
  "#bytes in __debug_info": 4941807,
  "#bytes in __debug_ranges": 1331936,
  "#bytes in __debug_str": 4509604,
  "#bytes in __apple_names": 1066460,
  "#bytes in __apple_objc": 36,
  "#bytes in __apple_namespac": 472,
  "#bytes in __apple_types": 136341,
  "#bytes in __debug_frame": 23576,
  "#bytes in __debug_line": 536585,
  "#variables processed by location statistics": 217373,
  "#variables with 0% of parent scope covered by DW_AT_location": 66634,
  "#variables with (0%,10%) of parent scope covered by DW_AT_location": 1419,
  "#variables with [10%,20%) of parent scope covered by DW_AT_location": 1127,
  "#variables with [20%,30%) of parent scope covered by DW_AT_location": 3206,
  "#variables with [30%,40%) of parent scope covered by DW_AT_location": 3730,
  "#variables with [40%,50%) of parent scope covered by DW_AT_location": 1901,
  "#variables with [50%,60%) of parent scope covered by DW_AT_location": 4622,
  "#variables with [60%,70%) of parent scope covered by DW_AT_location": 1739,
  "#variables with [70%,80%) of parent scope covered by DW_AT_location": 1849,
  "#variables with [80%,90%) of parent scope covered by DW_AT_location": 5998,
  "#variables with [90%,100%) of parent scope covered by DW_AT_location": 3301,
  "#variables with 100% of parent scope covered by DW_AT_location": 121847,
  "#variables - entry values with 0% of parent scope covered by DW_AT_location": 165,
  "#variables - entry values with (0%,10%) of parent scope covered by DW_AT_location": 1450,
  "#variables - entry values with [10%,20%) of parent scope covered by DW_AT_location": 1157,
  "#variables - entry values with [20%,30%) of parent scope covered by DW_AT_location": 3212,
  "#variables - entry values with [30%,40%) of parent scope covered by DW_AT_location": 3747,
  "#variables - entry values with [40%,50%) of parent scope covered by DW_AT_location": 1904,
  "#variables - entry values with [50%,60%) of parent scope covered by DW_AT_location": 4626,
  "#variables - entry values with [60%,70%) of parent scope covered by DW_AT_location": 1741,
  "#variables - entry values with [70%,80%) of parent scope covered by DW_AT_location": 1861,
  "#variables - entry values with [80%,90%) of parent scope covered by DW_AT_location": 6001,
  "#variables - entry values with [90%,100%) of parent scope covered by DW_AT_location": 3566,
  "#variables - entry values with 100% of parent scope covered by DW_AT_location": 121474,
  "#params processed by location statistics": 196971,
  "#params with 0% of parent scope covered by DW_AT_location": 59233,
  "#params with (0%,10%) of parent scope covered by DW_AT_location": 895,
  "#params with [10%,20%) of parent scope covered by DW_AT_location": 935,
  "#params with [20%,30%) of parent scope covered by DW_AT_location": 2922,
  "#params with [30%,40%) of parent scope covered by DW_AT_location": 3482,
  "#params with [40%,50%) of parent scope covered by DW_AT_location": 1704,
  "#params with [50%,60%) of parent scope covered by DW_AT_location": 4113,
  "#params with [60%,70%) of parent scope covered by DW_AT_location": 1070,
  "#params with [70%,80%) of parent scope covered by DW_AT_location": 1039,
  "#params with [80%,90%) of parent scope covered by DW_AT_location": 4750,
  "#params with [90%,100%) of parent scope covered by DW_AT_location": 2372,
  "#params with 100% of parent scope covered by DW_AT_location": 114456,
  "#params - entry values with 0% of parent scope covered by DW_AT_location": 87,
  "#params - entry values with (0%,10%) of parent scope covered by DW_AT_location": 926,
  "#params - entry values with [10%,20%) of parent scope covered by DW_AT_location": 965,
  "#params - entry values with [20%,30%) of parent scope covered by DW_AT_location": 2928,
  "#params - entry values with [30%,40%) of parent scope covered by DW_AT_location": 3499,
  "#params - entry values with [40%,50%) of parent scope covered by DW_AT_location": 1707,
  "#params - entry values with [50%,60%) of parent scope covered by DW_AT_location": 4117,
  "#params - entry values with [60%,70%) of parent scope covered by DW_AT_location": 1072,
  "#params - entry values with [70%,80%) of parent scope covered by DW_AT_location": 1051,
  "#params - entry values with [80%,90%) of parent scope covered by DW_AT_location": 4753,
  "#params - entry values with [90%,100%) of parent scope covered by DW_AT_location": 2637,
  "#params - entry values with 100% of parent scope covered by DW_AT_location": 114083,
  "#local vars processed by location statistics": 20402,
  "#local vars with 0% of parent scope covered by DW_AT_location": 7401,
  "#local vars with (0%,10%) of parent scope covered by DW_AT_location": 524,
  "#local vars with [10%,20%) of parent scope covered by DW_AT_location": 192,
  "#local vars with [20%,30%) of parent scope covered by DW_AT_location": 284,
  "#local vars with [30%,40%) of parent scope covered by DW_AT_location": 248,
  "#local vars with [40%,50%) of parent scope covered by DW_AT_location": 197,
  "#local vars with [50%,60%) of parent scope covered by DW_AT_location": 509,
  "#local vars with [60%,70%) of parent scope covered by DW_AT_location": 669,
  "#local vars with [70%,80%) of parent scope covered by DW_AT_location": 810,
  "#local vars with [80%,90%) of parent scope covered by DW_AT_location": 1248,
  "#local vars with [90%,100%) of parent scope covered by DW_AT_location": 929,
  "#local vars with 100% of parent scope covered by DW_AT_location": 7391,
  "#local vars - entry values with 0% of parent scope covered by DW_AT_location": 78,
  "#local vars - entry values with (0%,10%) of parent scope covered by DW_AT_location": 524,
  "#local vars - entry values with [10%,20%) of parent scope covered by DW_AT_location": 192,
  "#local vars - entry values with [20%,30%) of parent scope covered by DW_AT_location": 284,
  "#local vars - entry values with [30%,40%) of parent scope covered by DW_AT_location": 248,
  "#local vars - entry values with [40%,50%) of parent scope covered by DW_AT_location": 197,
  "#local vars - entry values with [50%,60%) of parent scope covered by DW_AT_location": 509,
  "#local vars - entry values with [60%,70%) of parent scope covered by DW_AT_location": 669,
  "#local vars - entry values with [70%,80%) of parent scope covered by DW_AT_location": 810,
  "#local vars - entry values with [80%,90%) of parent scope covered by DW_AT_location": 1248,
  "#local vars - entry values with [90%,100%) of parent scope covered by DW_AT_location": 929,
  "#local vars - entry values with 100% of parent scope covered by DW_AT_location": 7391
}
```
After the patch:
```
shubham at Mac-3004D6-3 build % dwarfdump /tmp/lto.o --statistics
{
  "version": 9,
  "file": "/tmp/lto.o",
  "format": "Mach-O arm64",
  "#functions": 7643,
  "#functions with location": 7604,
  "#inlined functions": 106782,
  "#inlined functions with abstract origins": 106782,
  "#unique source variables": 15598,
  "#source variables": 233649,
  "#source variables with location": 151230,
  "#call site entries": 106782,
  "#call site DIEs": 5501,
  "#call site parameter DIEs": 0,
  "sum_all_variables(#bytes in parent scope)": 19159476,
  "sum_all_variables(#bytes in any scope covered by DW_AT_location)": 17026388,
  "sum_all_variables(#bytes in parent scope covered by DW_AT_location)": 15715472,
  "sum_all_variables(#bytes in parent scope covered by DW_OP_entry_value)": 498004,
  "sum_all_params(#bytes in parent scope)": 14044244,
  "sum_all_params(#bytes in parent scope covered by DW_AT_location)": 11683644,
  "sum_all_params(#bytes in parent scope covered by DW_OP_entry_value)": 498004,
  "sum_all_local_vars(#bytes in parent scope)": 5115232,
  "sum_all_local_vars(#bytes in parent scope covered by DW_AT_location)": 4031828,
  "sum_all_local_vars(#bytes in parent scope covered by DW_OP_entry_value)": 0,
  "#bytes within functions": 658456,
  "#bytes within inlined functions": 615040,
  "#params": 84865,
  "#params with source location": 84865,
  "#params with type": 84865,
  "#params with binary location": 84774,
  "#local vars": 13450,
  "#local vars with source location": 13450,
  "#local vars with type": 13450,
  "#local vars with binary location": 13305,
  "#bytes in __debug_loc": 3117767,
  "#bytes in __debug_abbrev": 3994,
  "#bytes in __debug_info": 4943175,
  "#bytes in __debug_ranges": 1331936,
  "#bytes in __debug_str": 4509604,
  "#bytes in __apple_names": 1066460,
  "#bytes in __apple_objc": 36,
  "#bytes in __apple_namespac": 472,
  "#bytes in __apple_types": 136341,
  "#bytes in __debug_frame": 23576,
  "#bytes in __debug_line": 537632,
  "#variables processed by location statistics": 217373,
  "#variables with 0% of parent scope covered by DW_AT_location": 66492,
  "#variables with (0%,10%) of parent scope covered by DW_AT_location": 1420,
  "#variables with [10%,20%) of parent scope covered by DW_AT_location": 1129,
  "#variables with [20%,30%) of parent scope covered by DW_AT_location": 3213,
  "#variables with [30%,40%) of parent scope covered by DW_AT_location": 3741,
  "#variables with [40%,50%) of parent scope covered by DW_AT_location": 1903,
  "#variables with [50%,60%) of parent scope covered by DW_AT_location": 4634,
  "#variables with [60%,70%) of parent scope covered by DW_AT_location": 1767,
  "#variables with [70%,80%) of parent scope covered by DW_AT_location": 1850,
  "#variables with [80%,90%) of parent scope covered by DW_AT_location": 6009,
  "#variables with [90%,100%) of parent scope covered by DW_AT_location": 3302,
  "#variables with 100% of parent scope covered by DW_AT_location": 121913,
  "#variables - entry values with 0% of parent scope covered by DW_AT_location": 175,
  "#variables - entry values with (0%,10%) of parent scope covered by DW_AT_location": 1450,
  "#variables - entry values with [10%,20%) of parent scope covered by DW_AT_location": 1160,
  "#variables - entry values with [20%,30%) of parent scope covered by DW_AT_location": 3219,
  "#variables - entry values with [30%,40%) of parent scope covered by DW_AT_location": 3758,
  "#variables - entry values with [40%,50%) of parent scope covered by DW_AT_location": 1906,
  "#variables - entry values with [50%,60%) of parent scope covered by DW_AT_location": 4638,
  "#variables - entry values with [60%,70%) of parent scope covered by DW_AT_location": 1769,
  "#variables - entry values with [70%,80%) of parent scope covered by DW_AT_location": 1862,
  "#variables - entry values with [80%,90%) of parent scope covered by DW_AT_location": 6012,
  "#variables - entry values with [90%,100%) of parent scope covered by DW_AT_location": 3567,
  "#variables - entry values with 100% of parent scope covered by DW_AT_location": 121540,
  "#params processed by location statistics": 196971,
  "#params with 0% of parent scope covered by DW_AT_location": 59166,
  "#params with (0%,10%) of parent scope covered by DW_AT_location": 896,
  "#params with [10%,20%) of parent scope covered by DW_AT_location": 935,
  "#params with [20%,30%) of parent scope covered by DW_AT_location": 2922,
  "#params with [30%,40%) of parent scope covered by DW_AT_location": 3482,
  "#params with [40%,50%) of parent scope covered by DW_AT_location": 1704,
  "#params with [50%,60%) of parent scope covered by DW_AT_location": 4115,
  "#params with [60%,70%) of parent scope covered by DW_AT_location": 1070,
  "#params with [70%,80%) of parent scope covered by DW_AT_location": 1039,
  "#params with [80%,90%) of parent scope covered by DW_AT_location": 4750,
  "#params with [90%,100%) of parent scope covered by DW_AT_location": 2373,
  "#params with 100% of parent scope covered by DW_AT_location": 114519,
  "#params - entry values with 0% of parent scope covered by DW_AT_location": 87,
  "#params - entry values with (0%,10%) of parent scope covered by DW_AT_location": 926,
  "#params - entry values with [10%,20%) of parent scope covered by DW_AT_location": 966,
  "#params - entry values with [20%,30%) of parent scope covered by DW_AT_location": 2928,
  "#params - entry values with [30%,40%) of parent scope covered by DW_AT_location": 3499,
  "#params - entry values with [40%,50%) of parent scope covered by DW_AT_location": 1707,
  "#params - entry values with [50%,60%) of parent scope covered by DW_AT_location": 4119,
  "#params - entry values with [60%,70%) of parent scope covered by DW_AT_location": 1072,
  "#params - entry values with [70%,80%) of parent scope covered by DW_AT_location": 1051,
  "#params - entry values with [80%,90%) of parent scope covered by DW_AT_location": 4753,
  "#params - entry values with [90%,100%) of parent scope covered by DW_AT_location": 2638,
  "#params - entry values with 100% of parent scope covered by DW_AT_location": 114146,
  "#local vars processed by location statistics": 20402,
  "#local vars with 0% of parent scope covered by DW_AT_location": 7326,
  "#local vars with (0%,10%) of parent scope covered by DW_AT_location": 524,
  "#local vars with [10%,20%) of parent scope covered by DW_AT_location": 194,
  "#local vars with [20%,30%) of parent scope covered by DW_AT_location": 291,
  "#local vars with [30%,40%) of parent scope covered by DW_AT_location": 259,
  "#local vars with [40%,50%) of parent scope covered by DW_AT_location": 199,
  "#local vars with [50%,60%) of parent scope covered by DW_AT_location": 519,
  "#local vars with [60%,70%) of parent scope covered by DW_AT_location": 697,
  "#local vars with [70%,80%) of parent scope covered by DW_AT_location": 811,
  "#local vars with [80%,90%) of parent scope covered by DW_AT_location": 1259,
  "#local vars with [90%,100%) of parent scope covered by DW_AT_location": 929,
  "#local vars with 100% of parent scope covered by DW_AT_location": 7394,
  "#local vars - entry values with 0% of parent scope covered by DW_AT_location": 88,
  "#local vars - entry values with (0%,10%) of parent scope covered by DW_AT_location": 524,
  "#local vars - entry values with [10%,20%) of parent scope covered by DW_AT_location": 194,
  "#local vars - entry values with [20%,30%) of parent scope covered by DW_AT_location": 291,
  "#local vars - entry values with [30%,40%) of parent scope covered by DW_AT_location": 259,
  "#local vars - entry values with [40%,50%) of parent scope covered by DW_AT_location": 199,
  "#local vars - entry values with [50%,60%) of parent scope covered by DW_AT_location": 519,
  "#local vars - entry values with [60%,70%) of parent scope covered by DW_AT_location": 697,
  "#local vars - entry values with [70%,80%) of parent scope covered by DW_AT_location": 811,
  "#local vars - entry values with [80%,90%) of parent scope covered by DW_AT_location": 1259,
  "#local vars - entry values with [90%,100%) of parent scope covered by DW_AT_location": 929,
  "#local vars - entry values with 100% of parent scope covered by DW_AT_location": 7394
}
```
We can see that in all metrics, we have better debug info. Is that worth the extra compile time in this one test is a different question however

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


More information about the llvm-commits mailing list