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:30:03 +0000 [thread overview] Message-ID: <bug-114215-4-xum1yNowhl@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 #4 from cqwrteur <unlvsur at live dot com> --- void test_demovector(checkedvector& vec, __SIZE_TYPE__ x) noexcept { for(__SIZE_TYPE__ i = 0; i < x; i++) vec[i]=5; } void test_demovector_forceinline(checkedvector& vec, __SIZE_TYPE__ x) noexcept { for(__SIZE_TYPE__ i = 0; i < x; i++) vec.index_forceinline(i)=5; } still more instructions for the first one even with a loop. test_demovector(checkedvector&, unsigned long): pushq %r12 movq %rdi, %r12 pushq %rbp movq %rsi, %rbp pushq %rbx xorl %ebx, %ebx .L10: cmpq %rbp, %rbx je .L13 movq %rbx, %rsi movq %r12, %rdi incq %rbx call checkedvector::operator[](unsigned long) movq $5, (%rax) jmp .L10 .L13: popq %rbx popq %rbp popq %r12 ret test_demovector_forceinline(checkedvector&, unsigned long): xorl %eax, %eax .L15: cmpq %rsi, %rax je .L18 movq (%rdi), %rcx movq 8(%rdi), %rdx subq %rcx, %rdx sarq $3, %rdx cmpq %rdx, %rax jb .L16 ud2 .L16: movq $5, (%rcx,%rax,8) incq %rax jmp .L15 .L18: ret
next prev parent reply other threads:[~2024-03-03 3:30 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 2024-03-03 3:30 ` unlvsur at live dot com [this message] 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-xum1yNowhl@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: linkBe 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).