public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "olegendo at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug target/64331] regcprop propagates registers noted as REG_DEAD Date: Mon, 28 Sep 2015 16:27:00 -0000 [thread overview] Message-ID: <bug-64331-4-pufQIrYCC2@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-64331-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64331 Oleg Endo <olegendo at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Target|avr |avr sh*-*-* CC| |olegendo at gcc dot gnu.org --- Comment #10 from Oleg Endo <olegendo at gcc dot gnu.org> --- I've got a similar case on SH. In the file spacetab.c, when compiled with -O2 -m4 -ml there's a sequence: cmp/eq r3,r4 movt r3 movt r12 cmp/gt r0,r2 which should be rather (after scheduling): cmp/eq r3,r4 movt r3 cmp/gt r0,r2 mov r3,r12 The sequence can be caught with a simple peephole: (define_peephole2 [(set (match_operand:SI 0 "arith_reg_dest") (match_operand:SI 1 "t_reg_operand")) (set (match_operand:SI 2 "arith_reg_dest") (match_operand:SI 3 "t_reg_operand"))] "TARGET_SH1" [(set (match_dup 0) (reg:SI T_REG)) (set (match_dup 2) (match_dup 0))]) which doesn't work for some reason. So I thought maybe something like this: (define_peephole2 [(set (match_operand:SI 0 "arith_reg_dest") (match_operand:SI 1 "t_reg_operand")) (set (match_operand:SI 2 "arith_reg_dest") (match_operand:SI 3 "t_reg_operand"))] "TARGET_SH1" [(const_int 0)] { emit_insn (gen_movt (operands[0], get_t_reg_rtx ())); emit_move_insn (operands[2], operands[0]); DONE; }) which emits the insns in the peephole2 pass as intended, but regcprop changes them again into the undesired movt-movt sequence. So I've tried adding a REG_DEAD note to the first insn: (define_peephole2 [(set (match_operand:SI 0 "arith_reg_dest") (match_operand:SI 1 "t_reg_operand")) (set (match_operand:SI 2 "arith_reg_dest") (match_operand:SI 3 "t_reg_operand"))] "TARGET_SH1" [(const_int 0)] { add_reg_note (emit_insn (gen_movt (operands[0], get_t_reg_rtx ())), REG_DEAD, get_t_reg_rtx ()); emit_move_insn (operands[2], operands[0]); DONE; }) and it is still ignored. regcprop also doesn't look at any costs, so the only solution to "fix" this is searching and replacing insns manually in split4.
next prev parent reply other threads:[~2015-09-28 16:27 UTC|newest] Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top 2014-12-16 13:07 [Bug rtl-optimization/64331] New: " senthil_kumar.selvaraj at atmel dot com 2014-12-16 13:08 ` [Bug rtl-optimization/64331] " senthil_kumar.selvaraj at atmel dot com 2014-12-16 14:31 ` [Bug target/64331] " rguenth at gcc dot gnu.org 2014-12-16 16:24 ` ebotcazou at gcc dot gnu.org 2014-12-17 2:34 ` senthil_kumar.selvaraj at atmel dot com 2014-12-17 15:12 ` ebotcazou at gcc dot gnu.org 2015-02-20 17:11 ` gjl at gcc dot gnu.org 2015-03-03 11:10 ` gjl at gcc dot gnu.org 2015-03-03 11:25 ` gjl at gcc dot gnu.org 2015-03-03 11:36 ` gjl at gcc dot gnu.org 2015-04-22 12:01 ` jakub at gcc dot gnu.org 2015-07-16 9:18 ` rguenth at gcc dot gnu.org 2015-09-28 16:27 ` olegendo at gcc dot gnu.org [this message] 2022-01-09 0:43 ` pinskia at gcc dot gnu.org 2023-05-28 17:02 ` gjl at gcc dot gnu.org 2023-05-28 17:02 ` gjl at gcc dot gnu.org
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-64331-4-pufQIrYCC2@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).