public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug rtl-optimization/103296] New: Select satisfied register for deleting noop move instruction.
@ 2021-11-17  2:15 rjiejie at me dot com
  2021-11-17  2:17 ` [Bug rtl-optimization/103296] " rjiejie at me dot com
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: rjiejie at me dot com @ 2021-11-17  2:15 UTC (permalink / raw)
  To: gcc-bugs

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug rtl-optimization/103296] Select satisfied register for deleting noop move instruction.
  2021-11-17  2:15 [Bug rtl-optimization/103296] New: Select satisfied register for deleting noop move instruction rjiejie at me dot com
@ 2021-11-17  2:17 ` 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
  2 siblings, 0 replies; 4+ messages in thread
From: rjiejie at me dot com @ 2021-11-17  2:17 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from jojo <rjiejie at me dot com> ---
My patch here:

https://gcc.gnu.org/pipermail/gcc-patches/2021-November/584589.html

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug rtl-optimization/103296] Select satisfied register for deleting noop move instruction.
  2021-11-17  2:15 [Bug rtl-optimization/103296] New: Select satisfied register for deleting noop move instruction rjiejie at me dot com
  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
  2 siblings, 0 replies; 4+ messages in thread
From: law at gcc dot gnu.org @ 2022-11-18 22:43 UTC (permalink / raw)
  To: gcc-bugs

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

Jeffrey A. Law <law at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
             Status|UNCONFIRMED                 |RESOLVED

--- Comment #2 from Jeffrey A. Law <law at gcc dot gnu.org> ---
Should have been fixed by JoJo's patch on the trunk last year.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug rtl-optimization/103296] Select satisfied register for deleting noop move instruction.
  2021-11-17  2:15 [Bug rtl-optimization/103296] New: Select satisfied register for deleting noop move instruction rjiejie at me dot com
  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
  2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-11-28 22:30 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |12.0

--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Fixed for GCC 12 by r12-5978-ga888259a71fbbb .

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-11-28 22:30 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-17  2:15 [Bug rtl-optimization/103296] New: Select satisfied register for deleting noop move instruction rjiejie at me dot com
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

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).