public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug rtl-optimization/111467] New: REE failing to eliminate redundant extension due to multiple reaching def(s)
@ 2023-09-18 22:32 vineetg at gcc dot gnu.org
  2023-09-18 22:55 ` [Bug rtl-optimization/111467] " vineetg at gcc dot gnu.org
  2023-09-19  3:00 ` law at gcc dot gnu.org
  0 siblings, 2 replies; 3+ messages in thread
From: vineetg at gcc dot gnu.org @ 2023-09-18 22:32 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 111467
           Summary: REE failing to eliminate redundant extension due to
                    multiple reaching def(s)
           Product: gcc
           Version: 13.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: rtl-optimization
          Assignee: vineetg at gcc dot gnu.org
          Reporter: vineetg at gcc dot gnu.org
                CC: jeffreyalaw at gmail dot com, jivanhakobyan9 at gmail dot com,
                    kito at gcc dot gnu.org, palmer at gcc dot gnu.org
  Target Milestone: ---

For the trivial test case below (credit goes to Palmer for mentioning this
almost 2 years ago).

int
foo6(int a, int b)
{
  return a > b ? a : b;
}

-O2 -march=rv64gc

foo6:
        mv      a5,a1
        bge     a1,a0,.L5
        mv      a5,a0
.L5:
        sext.w  a0,a5
        ret

REE fails to eliminate the sign extension due to multiple reaching definitions
constraint.

I don't know how involved or runtime cost relaxing the constraint is, so
opening this PR to investigate.

FWIW a zba build generates a max insn, eliminating the sext.w, but the vanilla
case shows where things can possibly be improved.

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

* [Bug rtl-optimization/111467] REE failing to eliminate redundant extension due to multiple reaching def(s)
  2023-09-18 22:32 [Bug rtl-optimization/111467] New: REE failing to eliminate redundant extension due to multiple reaching def(s) vineetg at gcc dot gnu.org
@ 2023-09-18 22:55 ` vineetg at gcc dot gnu.org
  2023-09-19  3:00 ` law at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: vineetg at gcc dot gnu.org @ 2023-09-18 22:55 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Vineet Gupta <vineetg at gcc dot gnu.org> ---
(insn 8 4 11 2 (set (reg:SI 15 a5 [orig:137 b ] [137])  <--- DEF #1
        (reg:SI 11 a1 [orig:136 b ] [136])) "max.c":12:20 207 {*movsi_internal}
     (nil))

(jump_insn 11 8 22 2 (set (pc)
        (if_then_else (ge (reg/v:DI 11 a1 [orig:136 b ] [136])
                (reg/v:DI 10 a0 [orig:135 a ] [135]))
            (label_ref 13)
            (pc))) "max.c":12:20 273 {*branchdi}
     (int_list:REG_BR_PROB 536870916 (nil))
 -> 13)

(insn 12 22 13 3 (set (reg:SI 15 a5 [orig:137 b ] [137])        <--- DEF #2
        (reg:SI 10 a0 [orig:135 a ] [135])) "max.c":12:20 207 {*movsi_internal}
     (nil))

(code_label 13 12 23 4 2 (nil) [1 uses])

(insn 19 14 20 4 (set (reg/i:DI 10 a0)  <-- USE: Multiple reaching DEFs
        (sign_extend:DI (reg:SI 15 a5 [orig:137 b ] [137]))) "max.c":13:1 122
{extendsidi2}
     (nil))

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

* [Bug rtl-optimization/111467] REE failing to eliminate redundant extension due to multiple reaching def(s)
  2023-09-18 22:32 [Bug rtl-optimization/111467] New: REE failing to eliminate redundant extension due to multiple reaching def(s) vineetg at gcc dot gnu.org
  2023-09-18 22:55 ` [Bug rtl-optimization/111467] " vineetg at gcc dot gnu.org
@ 2023-09-19  3:00 ` law at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: law at gcc dot gnu.org @ 2023-09-19  3:00 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |law at gcc dot gnu.org

--- Comment #2 from Jeffrey A. Law <law at gcc dot gnu.org> ---
I thought REE handled multiple reaching definition. So this is a bit of a
surprise.

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

end of thread, other threads:[~2023-09-19  3:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-09-18 22:32 [Bug rtl-optimization/111467] New: REE failing to eliminate redundant extension due to multiple reaching def(s) vineetg at gcc dot gnu.org
2023-09-18 22:55 ` [Bug rtl-optimization/111467] " vineetg at gcc dot gnu.org
2023-09-19  3:00 ` law 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).