http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59644
Jakub Jelinek <jakub at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |vmakarov at gcc dot gnu.org --- Comment #22 from Jakub Jelinek <jakub at gcc dot gnu.org> --- So, supposedly the: 10432 /* If drap has been set, but it actually isn't live at the start 10433 of the function and !stack_realign, there is no reason to set it up. */ 10434 if (crtl->drap_reg && !stack_realign) 10435 { 10436 basic_block bb = ENTRY_BLOCK_PTR_FOR_FN (cfun)->next_bb; 10437 if (! REGNO_REG_SET_P (DF_LR_IN (bb), REGNO (crtl->drap_reg))) 10438 { 10439 crtl->drap_reg = NULL_RTX; 10440 crtl->need_drap = false; 10441 } 10442 } hunk needs to be performed somewhere else (at the start of ira function, or during reload/LRA (reload_in_progress/lra_in_progress) or not at all. Supposedly the second crtl->drap_reg = NULL_RTX hunk in that function is fine, because that is done only if there are no %rsp/%rbp accesses in the function. And the ix86_save_reg change would need guarding by some other flag (a bit in * cfun->machine ?) that would be set when ix86_finalize_stack_realign_flags performed the optimization (but couldn't clear drap_reg because it was needed, but wasn't needed to be preserved).