https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94495
--- Comment #7 from Jakub Jelinek <jakub at gcc dot gnu.org> --- Created attachment 48246 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=48246&action=edit gcc10-pr94495.patch Untested fix. This does two things during var-tracking. One is try to reuse even more the SP_DERIVED_VALUE_P and VALUEs equated to that + CONST_INT in !frame_pointer_needed functions (ideally have just a single SP_DERIVED_VALUE_P) and through that make sure they can be all expressed using cfa_base_rtx or cfa_base_rtx + CONST_INT (and thus in DWARF using DW_OP_fbreg). And the second change is that for VALUEs that can be expressed that way it throws away all MO_VAL_SETs, we have the best expression for it (DW_OP_fbreg) that is constant through the function, so it is not beneficial to express it in one part of the function using that, in another part of the function using the stack pointer, in yet another part using some other register.