From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 962A23858D28; Thu, 10 Feb 2022 13:02:09 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 962A23858D28 From: "avi at scylladb dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug rtl-optimization/104484] -freorder-block-and-partition not splitting into sections with __builin_expect() Date: Thu, 10 Feb 2022 13:02:09 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: rtl-optimization X-Bugzilla-Version: 11.2.1 X-Bugzilla-Keywords: missed-optimization X-Bugzilla-Severity: normal X-Bugzilla-Who: avi at scylladb dot com X-Bugzilla-Status: UNCONFIRMED 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 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 10 Feb 2022 13:02:09 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D104484 --- Comment #2 from Avi Kivity --- (In reply to Andrew Pinski from comment #1) > But the assembly output does not make sense to the code you gave either. Apart from the missing .section directives, I didn't notice anything odd. M= aybe movl/testl could be optimized into cmpl. Ah, I moved this code from C++ so the function signatures are bad, should be fun(void). With the signatures adjusted, I get light: .LFB2: .cfi_startproc subq $8, %rsp .cfi_def_cfa_offset 16 call fun movl f1(%rip), %edx testl %edx, %edx jne .L8 .L6: addq $8, %rsp .cfi_remember_state .cfi_def_cfa_offset 8 jmp fun .p2align 4,,10 .p2align 3 .L8: .cfi_restore_state movl f2(%rip), %eax testl %eax, %eax je .L6 call very_heavy jmp .L6 .cfi_endproc Which still misses the .section directives and the peephole optimization to merge movl/testl.=