From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id B762F3898380; Thu, 6 Oct 2022 15:19:09 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B762F3898380 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1665069549; bh=jIAn5aoM8RMhyQGDlWJF+PesLuPwjyKCdVrsCPHHlro=; h=From:To:Subject:Date:In-Reply-To:References:From; b=lZYjeMQeUxxGj59UnfivoFODFexdaZwtYIeWvJnqvlQcIJzXgzhltkT0W7kFuPX54 7M8hMPBt4ImMo5dxz+YS9d5e6Eiy/cTPnGvvQW8FLE+fSSohPuUFvOrsLGU4J2cjHT /zAe1Fd0Y8SiCUvt0qQfsbSn3NIC68zJXUzRh8Go= From: "amonakov at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/107115] Wrong codegen from TBAA under stores that change effective type? Date: Thu, 06 Oct 2022 15:19:09 +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: 13.0 X-Bugzilla-Keywords: alias, wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: amonakov at gcc dot gnu.org X-Bugzilla-Status: NEW 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: cc 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=3D107115 Alexander Monakov changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |amonakov at gcc dot gnu.or= g, | |jakub at gcc dot gnu.org --- Comment #6 from Alexander Monakov --- Cc'ing Jakub for the problematic i386.md peephole that loses alias set info. As Andrew mentioned in comment #2, the next stop is combine, which sees (set (mem:DI (plus:DI (mult:DI (sign_extend:DI (reg:SI 101)) (const_int 8 [0x8])) (reg/v/f:DI 90 [ p4 ])) [1 MEM[(long int *)_11]+0 S8 A64]) (mem:DI (plus:DI (mult:DI (sign_extend:DI (reg:SI 101)) (const_int 8 [0x8])) (reg/v/f:DI 90 [ p4 ])) [2 *_11+0 S8 A64])) as a no-op move and removes it (but note differing alias sets in the MEMs). And with -fdisable-rtl-combine it is then broken by peephole2 of all things: ;; Attempt to optimize away memory stores of values the memory already ;; has. See PR79593. (define_peephole2 [(set (match_operand 0 "register_operand") (match_operand 1 "memory_operand")) (set (match_operand 2 "memory_operand") (match_dup 0))] "!MEM_VOLATILE_P (operands[1]) && !MEM_VOLATILE_P (operands[2]) && rtx_equal_p (operands[1], operands[2]) && !reg_overlap_mentioned_p (operands[0], operands[2])" [(set (match_dup 0) (match_dup 1))])=