public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/102893] New: [8/9/10/11/12 Regression] CDDCE does not detect empty infinite nested loops
@ 2021-10-22  9:40 tnfchris at gcc dot gnu.org
  2021-10-22 10:44 ` [Bug tree-optimization/102893] [9/10/11/12 " rguenth at gcc dot gnu.org
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: tnfchris at gcc dot gnu.org @ 2021-10-22  9:40 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102893

            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=0; 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

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2023-07-07  9:47 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-22  9:40 [Bug tree-optimization/102893] New: [8/9/10/11/12 Regression] CDDCE does not detect empty infinite nested loops tnfchris at gcc dot gnu.org
2021-10-22 10:44 ` [Bug tree-optimization/102893] [9/10/11/12 " rguenth at gcc dot gnu.org
2021-10-22 11:43 ` cvs-commit at gcc dot gnu.org
2021-10-22 11:43 ` [Bug tree-optimization/102893] [9/10/11 " rguenth at gcc dot gnu.org
2021-10-22 12:07 ` tnfchris at gcc dot gnu.org
2022-02-17 10:17 ` rguenth at gcc dot gnu.org
2022-02-17 11:26 ` cvs-commit at gcc dot gnu.org
2022-05-27  9:46 ` [Bug tree-optimization/102893] [10 " rguenth at gcc dot gnu.org
2022-06-28 10:46 ` jakub at gcc dot gnu.org
2023-07-07  9:47 ` rguenth at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).