public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "linkw at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug target/108184] New: rs6000: Use optimize_function_for_speed_p too early
Date: Tue, 20 Dec 2022 03:01:59 +0000	[thread overview]
Message-ID: <bug-108184-4@http.gcc.gnu.org/bugzilla/> (raw)

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

            Bug ID: 108184
           Summary: rs6000: Use optimize_function_for_speed_p too early
           Product: gcc
           Version: 13.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: linkw at gcc dot gnu.org
  Target Milestone: ---

In the review of patch [1] for PR105818, Honza pointed out 

"I think we should generally avoid doing decisions about size/speed
optimizations so early since the setting may change due to attributes or
profile feedback..."

I agreed that the current uses of optimize_function_for_speed_p in function
rs6000_option_override_internal are too early and can be inaccurate. I tried to
make the below test case to demonstrate it.

Compiled with -mdejagnu-tune=power8 -O3:

__attribute__ ((cold)) int
fusion_short (short *p)
{
  return p[0x12345];
}

Since the function is attributed with cold, it's considered not to optimize for
speed, so we shouldn't break the sign extended loads and fuse it with the
addis, that is it's unexpected to see extsh generated but we have:

        addis 3,3,0x2
        lhz 3,18058(3)
        extsh 3,3

[1] https://gcc.gnu.org/pipermail/gcc-patches/2022-November/607527.html

             reply	other threads:[~2022-12-20  3:02 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-20  3:01 linkw at gcc dot gnu.org [this message]
2022-12-20  3:04 ` [Bug target/108184] " linkw at gcc dot gnu.org
2023-04-26  6:57 ` rguenth at gcc dot gnu.org
2023-07-27  9:24 ` rguenth at gcc dot gnu.org
2024-05-21  9:13 ` jakub 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-108184-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).