From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id CC0DF385840A; Fri, 22 Oct 2021 09:40:37 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org CC0DF385840A From: "tnfchris at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/102893] New: [8/9/10/11/12 Regression] CDDCE does not detect empty infinite nested loops Date: Fri, 22 Oct 2021 09:40:37 +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: 8.5.0 X-Bugzilla-Keywords: missed-optimization X-Bugzilla-Severity: normal X-Bugzilla-Who: tnfchris at gcc dot gnu.org 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 keywords 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 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Oct 2021 09:40:37 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D102893 Bug ID: 102893 Summary: [8/9/10/11/12 Regression] CDDCE does not detect empty infinite nested loops Product: gcc Version: 8.5.0 Status: UNCONFIRMED Keywords: missed-optimization Severity: normal Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: tnfchris at gcc dot gnu.org Target Milestone: --- The following example int main() { while(1) { for(int i=3D0; i<9000000; i++){} } } In GCC 7 compiled to main: .L2: b .L2 but since GCC 8 compiles to main: .L3: mov w0, 21568 movk w0, 0x89, lsl 16 .L2: subs w0, w0, #1 bne .L2 b .L3 The difference seems to be in cddce which previously was able to detect the code as dead: ;; 3 loops found ;; ;; Loop 0 ;; header 0, latch 1 ;; depth 0, outer -1 ;; nodes: 0 1 2 3 4 5 6 ;; ;; Loop 1 ;; header 3, latch 6 ;; depth 1, outer 0 ;; nodes: 3 6 5 4 ;; ;; Loop 2 ;; header 5, latch 4 ;; depth 2, outer 1 ;; nodes: 5 4 ;; 2 succs { 3 } ;; 3 succs { 5 } ;; 4 succs { 5 } ;; 5 succs { 4 6 } ;; 6 succs { 3 } can not prove finiteness of loop 1 Removing basic block 4 Merging blocks 3 and 5 Removing basic block 6 but since GCC 8 does ;; 3 loops found ;; ;; Loop 0 ;; header 0, latch 1 ;; depth 0, outer -1 ;; nodes: 0 1 2 3 4 5 6 ;; ;; Loop 1 ;; header 3, latch 6 ;; depth 1, outer 0 ;; nodes: 3 6 5 4 ;; ;; Loop 2 ;; header 5, latch 4 ;; depth 2, outer 1 ;; nodes: 5 4 ;; 2 succs { 3 } ;; 3 succs { 5 } ;; 4 succs { 5 } ;; 5 succs { 4 6 } ;; 6 succs { 3 } cannot prove finiteness of loop 1=