From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 2EBD3385840E; Sun, 3 Mar 2024 03:27:24 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 2EBD3385840E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1709436444; bh=32uZIWwW0wBTCQrIU6DuVO3c/x5ikC9EeNwvj/XAL+0=; h=From:To:Subject:Date:In-Reply-To:References:From; b=cq8Ndle6CGbUIU2KO3IG3BT2zvwfvO5lrbAxNl7EUodXoXVHBrjofe9rCDh1AONfl f1E5M8fZo4ceBYIp/C5xFd3WtFeeYy5qSMibylFeOe6SuAUrjFq+TCFC5bgIH5h0vK Kz8NI44Mi2vKVYFX1e+9YB1rGt3mBkekjIWwUgJ0= From: "unlvsur at live dot com" 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 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: ipa X-Bugzilla-Version: 14.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: unlvsur at live dot com X-Bugzilla-Status: WAITING X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D114215 --- Comment #3 from cqwrteur --- 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.=