From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id A04F13849AF1; Sat, 13 Apr 2024 13:39:27 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A04F13849AF1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1713015567; bh=a1eOEHdPJ6dW1J2WqCFngjdkpG23J2xkvsoIosEkSnE=; h=From:To:Subject:Date:In-Reply-To:References:From; b=Owffn48Jc146VdIng/R9hE7i5kWA1z4ndnvt20xBnPhvVVDBjF9SRu+SpBkfH11SN Dez4Fj8FyGF4ntHwHXB8XKzpzWaVciodYBX7qSyEZOdYrclKEQUxmAivdkzYLWS7iY XsGquMdR5FFpLJfB0odfCGCHCOF4qz1juUNCPLfY= From: "xxs_chy at outlook dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/114704] Missed optimization : eliminate store if the value is known in all predecessors Date: Sat, 13 Apr 2024 13:39:27 +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: xxs_chy at outlook dot com 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=3D114704 --- Comment #3 from XChy --- (In reply to Andrew Pinski from comment #1) > Confirmed. A more general testcase: > ``` > void dummy(); >=20 > void src(int *p, int a){ > int t =3D *p; > if(t =3D=3D a) > goto then; > else { > dummy(); > t =3D *p; > if(t =3D=3D a) > goto then; > else > return; > } >=20 > then: > *p =3D t; // *p is already a, it's dead now > } >=20 > ``` Do you mean "*p =3D a" at the end?=