public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "rjiejie at me dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug rtl-optimization/103296] New: Select satisfied register for deleting noop move instruction.
Date: Wed, 17 Nov 2021 02:15:21 +0000	[thread overview]
Message-ID: <bug-103296-4@http.gcc.gnu.org/bugzilla/> (raw)

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103296

            Bug ID: 103296
           Summary: Select satisfied register for deleting noop move
                    instruction.
           Product: gcc
           Version: 10.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: rtl-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: rjiejie at me dot com
  Target Milestone: ---

I found this case in my riscv vector test case, and following is snippets of
problematic RTL:


before register renamer :
=========================

(insn 64 62 109 4 (parallel [
            (set (reg:VNx32HI 104 v8 [orig:148 _30 ] [148])
                (unspec:VNx32HI [
                        (plus:VNx32HI (reg:VNx32HI 100 v4 [orig:149 _31 ]
[149])
                            (zero_extend:VNx32HI (reg:VNx32QI 108 v12 [orig:159
_41 ] [159])))
                        (reg:SI 66 vl)
                    ] UNSPEC_USEVL))
            (use (reg:VNx32QI 67 vtype))
        ])
"/$GCC/lib/gcc/riscv64-unknown-linux-gnu/10.2.0/include/riscv_vector.h":1865:1
23384 {*wadduvnx32qi_wv_nosetvl}
     (nil))
(insn 109 64 67 4 (set (reg:VNx32HI 100 v4 [orig:147 _29 ] [147])
        (reg:VNx32HI 104 v8 [orig:148 _30 ] [148]))
"/$GCC/lib/gcc/riscv64-unknown-linux-gnu/10.2.0/include/riscv_vector.h":2815:1
21247 {*movvnx32hi}
     (nil))
(insn 67 109 69 4 (parallel [
            (set (reg:VNx32HI 100 v4 [orig:147 _29 ] [147])
                (unspec:VNx32HI [
                        (plus:VNx32HI (mult:VNx32HI (zero_extend:VNx32HI
(vec_duplicate:VNx32QI (reg:QI 10 a0 [184])))
                                (zero_extend:VNx32HI (reg:VNx32QI 98 v2
[orig:152 _34 ] [152])))
                            (reg:VNx32HI 100 v4 [orig:147 _29 ] [147]))
                        (reg:SI 66 vl)
                    ] UNSPEC_USEVL))
            (use (reg:VNx32QI 67 vtype))
        ])
"/$GCC/lib/gcc/riscv64-unknown-linux-gnu/10.2.0/include/riscv_vector.h":2815:1
27941 {*umaddvnx32qivnx32hi4_scalar_nosetvl}
     (expr_list:REG_EQUAL (unspec:VNx32HI [
                (plus:VNx32HI (mult:VNx32HI (zero_extend:VNx32HI (reg:VNx32QI
98 v2 [orig:152 _34 ] [152]))
                        (const_vector:VNx32HI [
                                (const_int 2 [0x2])
                            ]))
                    (reg:VNx32HI 104 v8 [orig:148 _30 ] [148]))
                (reg:SI 66 vl)
            ] UNSPEC_USEVL)
        (nil)))


after register renamer :
========================

(insn 64 62 109 4 (parallel [
            (set (reg:VNx32HI 100 v4 [orig:148 _30 ] [148])
                (unspec:VNx32HI [
                        (plus:VNx32HI (reg:VNx32HI 116 v20 [orig:149 _31 ]
[149])
                            (zero_extend:VNx32HI (reg:VNx32QI 108 v12 [orig:159
_41 ] [159])))
                        (reg:SI 66 vl)
                    ] UNSPEC_USEVL))
            (use (reg:VNx32QI 67 vtype))
        ])
"/$GCC/lib/gcc/riscv64-unknown-linux-gnu/10.2.0/include/riscv_vector.h":1865:1
23384 {*wadduvnx32qi_wv_nosetvl}
     (expr_list:REG_DEAD (reg:VNx32QI 108 v12 [orig:159 _41 ] [159])
        (expr_list:REG_DEAD (reg:VNx32HI 100 v4 [orig:149 _31 ] [149])
            (nil))))
(insn:TI 109 64 67 4 (set (reg:VNx32HI 124 v28 [orig:147 _29 ] [147])
        (reg:VNx32HI 100 v4 [orig:148 _30 ] [148]))
"/$GCC/lib/gcc/riscv64-unknown-linux-gnu/10.2.0/include/riscv_vector.h":2815:1
21247 {*movvnx32hi}
     (expr_list:REG_DEAD (reg:VNx32HI 104 v8 [orig:148 _30 ] [148])
        (nil)))
(insn 67 109 69 4 (parallel [
            (set (reg:VNx32HI 124 v28 [orig:147 _29 ] [147])
                (unspec:VNx32HI [
                        (plus:VNx32HI (mult:VNx32HI (zero_extend:VNx32HI
(vec_duplicate:VNx32QI (reg:QI 10 a0 [184])))
                                (zero_extend:VNx32HI (reg:VNx32QI 114 v18
[orig:152 _34 ] [152])))
                            (reg:VNx32HI 124 v28 [orig:147 _29 ] [147]))
                        (reg:SI 66 vl)
                    ] UNSPEC_USEVL))
            (use (reg:VNx32QI 67 vtype))
        ])
"/$GCC/lib/gcc/riscv64-unknown-linux-gnu/10.2.0/include/riscv_vector.h":2815:1
27941 {*umaddvnx32qivnx32hi4_scalar_nosetvl}
     (expr_list:REG_DEAD (reg:VNx32HI 104 v8 [orig:148 _30 ] [148])
        (expr_list:REG_DEAD (reg:VNx32QI 98 v2 [orig:152 _34 ] [152])
            (expr_list:REG_DEAD (reg:VNx32QI 98 v2 [orig:152 _34 ] [152])
                (expr_list:REG_EQUAL (unspec:VNx32HI [
                            (plus:VNx32HI (mult:VNx32HI (zero_extend:VNx32HI
(reg:VNx32QI 98 v2 [orig:152 _34 ] [152]))
                                    (const_vector:VNx32HI [
                                            (const_int 2 [0x2])
                                        ]))
                                (reg:VNx32HI 104 v8 [orig:148 _30 ] [148]))
                            (reg:SI 66 vl)
                        ] UNSPEC_USEVL)
                    (nil))))))


>From rnreg pass RTL dump as following, it will try to tie chains in a move
instruction for a single output.
So we can keep same register (dest and source) in this move instruction, it
means
insn 64 renamed as v4, and insn 109 should keep v4 as noop move instruction.

Register v8 in insn 64deferring rescan insn with uid = 64.
deferring rescan insn with uid = 109.
, renamed as v4
Register v4 in insn 109deferring rescan insn with uid = 109.
deferring rescan insn with uid = 67.
deferring rescan insn with uid = 69.
, renamed as v28

             reply	other threads:[~2021-11-17  2:15 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-17  2:15 rjiejie at me dot com [this message]
2021-11-17  2:17 ` [Bug rtl-optimization/103296] " rjiejie at me dot com
2022-11-18 22:43 ` law at gcc dot gnu.org
2022-11-28 22:30 ` pinskia 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-103296-4@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: link
Be 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).