On Tue, Aug 18, 2020 at 5:42 PM Uros Bizjak <ubiz...@gmail.com> wrote: > > -fcf-protection code in restore_stack_nonlocal uses a branch based on > a clobber result. The patch adds missing compare and completely > rewrites the expander to use high-level functions in RTL construction.
Backported gcc-10 version introduces only minimal change to the code. 2020-08-18 Uroš Bizjak <ubiz...@gmail.com> gcc/ChangeLog: PR target/96536 * config/i386/i386.md (restore_stack_nonlocal): Add missing compare RTX. Bootstrapped and regression tested on x86_64-linux-gnu {,-m32}. Uros.
diff --git a/gcc/config/i386/i386.md b/gcc/config/i386/i386.md index 292de142e90..44dbb79d008 100644 --- a/gcc/config/i386/i386.md +++ b/gcc/config/i386/i386.md @@ -18696,8 +18696,11 @@ emit_insn (tmp); /* Compare and jump over adjustment code. */ - noadj_label = gen_label_rtx (); + tmp = gen_rtx_COMPARE (CCZmode, reg_ssp, const0_rtx); flags = gen_rtx_REG (CCZmode, FLAGS_REG); + emit_insn (gen_rtx_SET (flags, tmp)); + + noadj_label = gen_label_rtx (); tmp = gen_rtx_EQ (VOIDmode, flags, const0_rtx); tmp = gen_rtx_IF_THEN_ELSE (VOIDmode, tmp, gen_rtx_LABEL_REF (VOIDmode, noadj_label),