1
Fork 0

When the required discriminator value exceeds LLVM's limits, drop the debug info for the function instead of panicking.

The maximum discriminator value LLVM can currently encode is 2^12. If macro use
results in more than 2^12 calls to the same function attributed to the same
callsite, and those calls are MIR-inlined, we will require more than the maximum
discriminator value to completely represent the debug information. Once we reach
that point drop the debug info instead.
This commit is contained in:
Kyle Huey 2024-11-18 18:48:10 -08:00
parent 1e4ebb0ccd
commit f5b023bd9c
5 changed files with 4175 additions and 31 deletions

View file

@ -294,12 +294,12 @@ impl<'ll, 'tcx> DebugInfoCodegenMethods<'tcx> for CodegenCx<'ll, 'tcx> {
}
// Initialize fn debug context (including scopes).
let empty_scope = DebugScope {
let empty_scope = Some(DebugScope {
dbg_scope: self.dbg_scope_fn(instance, fn_abi, Some(llfn)),
inlined_at: None,
file_start_pos: BytePos(0),
file_end_pos: BytePos(0),
};
});
let mut fn_debug_context = FunctionDebugContext {
scopes: IndexVec::from_elem(empty_scope, &mir.source_scopes),
inlined_function_scopes: Default::default(),