https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65496
Jakub Jelinek <jakub at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |rth at gcc dot gnu.org --- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> --- And the problem is that with these weirdo scheduling options the scheduler schedules the (insn/f:TI 620 60 37 2 (set (reg:DI 39 r10) (plus:DI (reg/f:DI 7 sp) (const_int 8 [0x8]))) pr65496.c:3 214 {*leadi} (nil)) instruction before the shrink-wrapping conditional jump: (jump_insn:TI 38 45 43 2 (set (pc) (if_then_else (eq (reg:CCZ 17 flags) (const_int 0 [0])) (label_ref:DI 645) (pc))) pr65496.c:4 613 {*jcc_1} (expr_list:REG_DEAD (reg:CCZ 17 flags) (int_list:REG_BR_PROB 900 (nil))) -> 645) At the end of the function we have: (insn/f:TI 641 640 645 40 (set (reg/f:DI 7 sp) (plus:DI (reg:DI 39 r10) (const_int -8 [0xfffffffffffffff8]))) pr65496.c:6 214 {*leadi} (expr_list:REG_DEAD (reg:DI 39 r10) (expr_list:REG_CFA_DEF_CFA (plus:DI (reg/f:DI 7 sp) (const_int 8 [0x8])) (nil)))) (code_label 645 641 644 41 106 "" [1 uses]) (note 644 645 663 41 [bb 41] NOTE_INSN_BASIC_BLOCK) (jump_insn 663 644 643 41 (parallel [ (simple_return) (unspec [ (const_int 0 [0]) ] UNSPEC_REP) ]) pr65496.c:6 682 {simple_return_internal_long} (nil)) (barrier 643 663 355) And the problem is that because the r10 = rsp + 8 frame related instruction is moved before the shrink-wrapping jump we assume CFA is in r10 + 0, but before fallthru into the return we have a CFA restore note to use r8 + 8 again as CFA (not really needed in this case, but desirable for the case when the r10 = rsp + 8 instruction isn't moved. Richard, any thoughts what to do about this? Avoid scheduling frame related instructions across conditional jumps? Something else?