LTO location streaming overhauled for large files
LTO location handling improved with optimized map creation and 64-bit location_t to prevent out-of-memory issues.
This commit addresses issues in LTO’s location streaming, particularly concerning ‘out of location_t space’ errors for large files with complex source structures. The solution involves optimizing the lto_location_cache to reduce the number of linemaps created, especially by sorting locations, and migrating location_t to 64 bits. These changes significantly mitigate practical memory exhaustion problems for LTO processing.
In Details
This change revises LTO's location streaming mechanism, directly addressing PR65536's concerns about running out of location_t space. The introduction of a 64-bit location_t provides substantially more address space. Additionally, lto_location_cache is enhanced to optimize map creation by sorting locations within LTO sections, reducing the overhead associated with non-sequential additions common in LTO's object file processing. While not a theoretical fix for all edge cases, it resolves practical issues for large sources.
- LTO
- Link-Time Optimization. A compilation technique where optimization occurs at link time rather than during individual compilation units, allowing for inter-procedural optimizations across the entire program.
- location_t
- A data type used by GCC to represent a location in source code, typically a combination of file, line number, and column number. Its size and management are critical for debugging information and diagnostics.
- linemap
- A data structure used by the compiler to map intermediate code locations to source file locations (filename, line number, column number). It's crucial for generating accurate debugging information and diagnostics.
- PR65536
- A bug report (Problem Report) filed in the GCC Bugzilla database, specifically concerning issues with location management in LTO.