From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 6FEBB388E831; Sat, 27 Jun 2020 11:59:23 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 6FEBB388E831 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1593259163; bh=VoTdENrCQ0kIs9pok+OHRSxYb7RSL0thPnrEcBAKjBY=; h=From:To:Subject:Date:In-Reply-To:References:From; b=Y3JUqloa1KQ+UMZX7E/SWMBWLsd/Ay6hWav0K1OoK2o7CdVSPCgeqm+MF6zL4MtJP ZXfUmP2/ABfOKQpF+4wdtp8yp8V3a81cuB04wUoEsYuGQoa0CQJc0FNqfueSDRs3AM PzbDXJygVk8T1lUpRmAbtayrzYcuRPITAobc1AQs= From: "glisse at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/95926] Failure to optimize xor pattern when using temporary variable Date: Sat, 27 Jun 2020 11:59:23 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: tree-optimization X-Bugzilla-Version: 11.0 X-Bugzilla-Keywords: missed-optimization X-Bugzilla-Severity: normal X-Bugzilla-Who: glisse at gcc dot gnu.org 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: Sat, 27 Jun 2020 11:59:23 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D95926 --- Comment #1 from Marc Glisse --- It is different to gcc because in the first case, tmp is used twice, while = in the second case, each a&b is only used once, and gcc only transforms (a&b)^= b to b&~a if this is the only use of a&b. Yes, this heuristic often backfires, b= ut as long as we consider &~ as 2 operations, not restricting the transformati= on could generate worse code in some cases.=