From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 5C9213858414; Sun, 3 Mar 2024 03:30:04 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 5C9213858414 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1709436604; bh=LFrttUciOCQQR0XwofJbWKWOiLiyotBGzxlv47VHRvE=; h=From:To:Subject:Date:In-Reply-To:References:From; b=AYKDNnXckCsN9vlw+PrupQOXhga2n54l6j/QWjQ5N5BYVChIEKIm0PNAO/CWWcZ9H m+OaL83g/x4wxx8b0LSJtEMVO+EL4WUvNUtK7I6XrtnIDdKOxJpA7ILLznh7+cZfZk AZN081IZsOiIHWnCX77Ei9G5f3SOAz5/g137zlIs= 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:30:03 +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 #4 from cqwrteur --- void test_demovector(checkedvector& vec, __SIZE_TYPE__ x) noexcept { for(__SIZE_TYPE__ i =3D 0; i < x; i++) vec[i]=3D5; } void test_demovector_forceinline(checkedvector& vec, __SIZE_TYPE__ x) noexc= ept { for(__SIZE_TYPE__ i =3D 0; i < x; i++) vec.index_forceinline(i)=3D5; } 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=