From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 3580E3858C50; Fri, 28 Oct 2022 09:30:48 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 3580E3858C50 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1666949448; bh=wqkMK2HYbLiR9M7jZuXDTQu4SMyhC1zziqC6KAPYZbI=; h=From:To:Subject:Date:In-Reply-To:References:From; b=CH1s/+RSVMJQktTL9EZqruLOXFrJa7MYaHgn5NIAcJYhxgHk8WlPXXu+ZlWn9+T+6 3hw1+WbMUiPP367pzuFo5Az6unMkckQlMb54fm25A908TALGe1JHM1H79i4zGibxXX 2/SIyzo0zDXHp8br7DyWIZrxvtz/UIy5afy4/aAI= From: "rguenth at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/107389] Always propagate __builtin_assume_aligned Date: Fri, 28 Oct 2022 09:30:46 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: middle-end X-Bugzilla-Version: 12.2.1 X-Bugzilla-Keywords: missed-optimization X-Bugzilla-Severity: enhancement X-Bugzilla-Who: rguenth at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: rguenth at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: attachments.created 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=3D107389 --- Comment #5 from Richard Biener --- Created attachment 53784 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=3D53784&action=3Dedit prototype This implements an -O0 fold-builtins pass. I've disabled some but not all "optimizations" and instead of just throwing away __builtin_assume_aligned I'm processing it at -O0 (the machinery from CCP relies on a lattice, with optimization we should at least merge with the alignment info on the LHS). On s390 I then see foo: .LFB0: .cfi_startproc stmg %r11,%r15,88(%r15) .cfi_offset 11, -72 .cfi_offset 12, -64 .cfi_offset 13, -56 .cfi_offset 14, -48 .cfi_offset 15, -40 aghi %r15,-176 .cfi_def_cfa_offset 336 lgr %r11,%r15 .cfi_def_cfa_register 11 stg %r2,168(%r11) stg %r3,160(%r11) lg %r1,160(%r11) lpq %r2,0(%r1) lg %r1,168(%r11) stmg %r2,%r3,0(%r1) lg %r2,168(%r11) lmg %r11,%r15,264(%r11) .cfi_restore 15 .cfi_restore 14 .cfi_restore 13 .cfi_restore 12 .cfi_restore 11 .cfi_def_cfa 15, 160 br %r14 .cfi_endproc specifically I did not disable __atomic_add_fetch_* optimizations to .ATOMIC_ADD_FETCH_CMP_0 and friends and also kept optimizing stack_save/restore.=