From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id CACC53858416; Fri, 15 Mar 2024 08:01:59 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org CACC53858416 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1710489719; bh=j3rXnt6xmjWRgxb//4REaugsSjbHUBjqMZz+pY8DOIU=; h=From:To:Subject:Date:In-Reply-To:References:From; b=rv6s+itZQ0Ijl6811Irp6tLKAV6E/MLQHqK1KRQP+KFzIn1XmVKgsgps6bugLhYPU NovHv3etecq2JRJwFRlU7MYuZ3wcujpBKgl1dJvA2rY4OGZY81m7j09yaVX+Rr/XJ6 dJMIH4uZdpcTyLsT17CgL+RMOFpniIq9ijn0bcIE= From: "jakub at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/114331] Missed optimization: indicate knownbits from dominating condition switch(trunc(a)) Date: Fri, 15 Mar 2024 08:01:57 +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: 14.0 X-Bugzilla-Keywords: missed-optimization X-Bugzilla-Severity: normal X-Bugzilla-Who: jakub 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: 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=3D114331 --- Comment #14 from Jakub Jelinek --- (In reply to Aldy Hernandez from comment #13) > And yes Jakub, as you have noticed, BIT_IOR_EXPR, BIT_XOR_EXPR, and likely > other operators may need to be tweaked to take bitmasks into account. I > wouldn't be surprised if there's a lot of low hanging fruit in this space. I think next to BIT_AND_EXPR with const second operand in the reverse direc= tion it certainly is BIT_IOR_EXPR with const second operand in the forward direction, that is another thing where some bits become unknown compared to= the source bitmask. Whether it is also BIT_XOR_EXPR/BIT_NOT_EXPR, dunno right now, we'd need to play with testcases. Maybe it is also BIT_AND_EXPR with const second opera= nd in the forward direction (and then BIT_IOR_EXPR with const second operand in the reverse direction and BIT_XOR_EXPR with const second operand and BIT_NOT_EXPR in both directions) which instead of making some bits unknown (i.e. oring some bits into mask) makes some bits known (i.e. removes them f= rom the mask; for xor/not keeps mask as is but modifies value).=