From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id D96F73858CDB; Fri, 12 Apr 2024 14:32:53 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D96F73858CDB DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1712932373; bh=ljV9R2YFSyDRQfnuERZN2+SlVCbQMX7Ew7gyPKYEBfM=; h=From:To:Subject:Date:From; b=s1GXcy5P5P5Rufz/sULAKwTy3hz0ZKKg7+AD86HU0WqdiFwkroG0L5BJ5t/tKs/T5 Rou1u5VC7yLxyjWHkkG2Sn+rjKp6K6By/mUB44bzs8Mq1tVmMxO1s9xmU+sd5qZwi0 JSNfO1FiK58AxrCktT9L7oU3m6I46wPrlFQXg7mM= From: "xxs_chy at outlook dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/114704] New: Missed optimization : eliminate store if the value is known in all predecessors Date: Fri, 12 Apr 2024 14:32:53 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: tree-optimization X-Bugzilla-Version: 14.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: xxs_chy at outlook dot com 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: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone Message-ID: 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 Bug ID: 114704 Summary: Missed optimization : eliminate store if the value is known in all predecessors Product: gcc Version: 14.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: xxs_chy at outlook dot com Target Milestone: --- Godbolt link: https://godbolt.org/z/KEeGTM49E For code like: ``` void src(int *p){ if(*p =3D=3D 0) goto then; else { dummy(); if(*p =3D=3D 0) goto then; else return; } then: *p =3D 0; // *p is already 0, it's dead now } ``` In then basic block, *p is known to be 0 in all predecessors, thus the store "*p =3D 0" is redundant.=