From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 953B23858D28; Tue, 3 Oct 2023 08:33:20 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 953B23858D28 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1696322000; bh=6SH0Ko6W7jk7wJuH1ubbsyGfV/n7dtnpaOLBsvnnRG4=; h=From:To:Subject:Date:In-Reply-To:References:From; b=eVOEtlvSSSLoaJRkbQNtHmTv2VGcQkGZsAhPQD/ep4mh0r6Kng0zTcoWce96sQBPH /hxMm1wHTaUiwbik8Imbl0NtxqfNZwvlvwQcZYgmX7umBBLPvRNT9RaYUTgGxN23f9 zeLPJm51t8m8QR+O8p4C33bP/R+diAEMMPf4AC3U= From: "jakub at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/111668] [12/13/14 Regression] vrp2 (match and simplify) introduces invalid wide signed Boolean values Date: Tue, 03 Oct 2023 08:33:20 +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: wrong-code 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: 14.0 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=3D111668 --- Comment #4 from Jakub Jelinek --- So, for the a ? -1 : 0 case (and similarly for a ? 0 : -1) we have 3 distin= ct cases. One is signed 1-bit precision type, for which we jump through the unnecessa= ry hops of trying to optimize e.g. the first one as (lshift (convert:type (convert:boolean_type_node @0) { integer_zero_node; }) and then optimizing = away the shift. Then the signed boolean case of larger precision, where we can choose what exactly we want it to simplify to, one is the negation in signed integer ty= pe of the same precision and another one would be to cast to signed boolean ty= pe rather than unsigned. And finally the case where both 1 and -1 are valid, where we should use the negation. If we go the negation route for the second subcase, that is the only case w= here we need build_nonstandard_integer_type. If we go with the casts, we don't = need it anywhere.=