public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "unlvsur at live dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug ipa/114215] GCC makes wrong decision for inline with -Os or -Oz to deal with trivial functions
Date: Sun, 03 Mar 2024 03:27:24 +0000	[thread overview]
Message-ID: <bug-114215-4-PriQZ2Rd1l@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-114215-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #3 from cqwrteur <unlvsur at live dot com> ---
test_demovector(checkedvector&):
        pushq   %rbx
        movq    %rdi, %rbx
        pushq   $4
        popq    %rsi
        call    checkedvector::operator[](unsigned long)
        movq    %rbx, %rdi
        movq    $5, (%rax)
        pushq   $6
        popq    %rsi
        call    checkedvector::operator[](unsigned long)
        movq    %rbx, %rdi
        movq    $5, (%rax)
        pushq   $10
        popq    %rsi
        call    checkedvector::operator[](unsigned long)
        movq    %rbx, %rdi
        movq    $5, (%rax)
        pushq   $5
        popq    %rsi
        call    checkedvector::operator[](unsigned long)
        movq    $5, (%rax)
        popq    %rbx
        ret
test_demovector_forceinline(checkedvector&):
        movq    (%rdi), %rax
        movq    8(%rdi), %rdx
        subq    %rax, %rdx
        cmpq    $32, %rdx
        ja      .L7
.L8:
        ud2
.L7:
        movq    $5, 32(%rax)
        cmpq    $48, %rdx
        jbe     .L8
        movq    $5, 48(%rax)
        cmpq    $80, %rdx
        jbe     .L8
        movq    $5, 80(%rax)
        movq    $5, 40(%rax)
        ret

see? first one has more instructions than the 2nd one.

  parent reply	other threads:[~2024-03-03  3:27 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-03  2:53 [Bug rtl-optimization/114215] New: " unlvsur at live dot com
2024-03-03  3:06 ` [Bug ipa/114215] " pinskia at gcc dot gnu.org
2024-03-03  3:18 ` pinskia at gcc dot gnu.org
2024-03-03  3:27 ` unlvsur at live dot com [this message]
2024-03-03  3:30 ` unlvsur at live dot com
2024-03-03  3:36 ` pinskia at gcc dot gnu.org
2024-03-03  3:44 ` [Bug ipa/114215] -Os or -Oz inlining seems wrong for vague linkage functions unlvsur at live dot com
2024-03-03  3:45 ` unlvsur at live dot com
2024-03-06  2:23 ` unlvsur at live dot com

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-114215-4-PriQZ2Rd1l@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).