From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id D5BC83858D20; Tue, 16 Jan 2024 08:13:01 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D5BC83858D20 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1705392781; bh=nIBczmyt5mEMXx5bIajt2oFvHl3SpgkWW+wVJV4RSso=; h=From:To:Subject:Date:In-Reply-To:References:From; b=lKL+xdW5FHjPxC5zKEh3ENaHnStoynh6Egdom453P6L+zHU7ZLLiqy9vF3ybNX6Xm UJwIm6nTN3nCtyiYlb651NQ7QAs3lgcsSgXIgCByXPtStqYLLXqD3fab7IY88VfJ0j le2hhfNmTueTEYdUG2uPPB0OCoqUV8tGBtRrsFUI= From: "rguenth at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/113411] ABS*ABS can be simplified to ABS Date: Tue, 16 Jan 2024 08:13:01 +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: enhancement X-Bugzilla-Who: rguenth 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: everconfirmed cf_reconfirmed_on bug_status 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=3D113411 Richard Biener changed: What |Removed |Added ---------------------------------------------------------------------------- Ever confirmed|0 |1 Last reconfirmed| |2024-01-16 Status|UNCONFIRMED |NEW --- Comment #1 from Richard Biener --- I think it's OK for reals with -fno-rounding-math. It's valid for integers with or without undefined overflow, the corner case to consider is abs(-INT_MAX - 1) * abs (b) where with undefined overflow the abs() is already invoking undefined behavior. The problematical multiplication is (-INT_MAX-1) * -1 but we cannot arrive at this from a defined input. For abs(a*b) the problematical input is -INT_MAX - 1 but we can't arrive at that either (b =3D=3D 1 with a =3D=3D -INT_MAX-1 is undefined, b =3D=3D -1 the s= ame).=