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

--- Comment #5 from Jan Hubicka <hubicka at gcc dot gnu.org> ---
This is now threaded by threadfull2:

Checking profitability of path (backwards):  bb:3 (2 insns) bb:2
  Control statement insns: 2
  Overall: 0 insns

path: 2->3->xx REJECTED
Checking profitability of path (backwards):  bb:3 (2 insns) bb:5 (latch)
  Control statement insns: 2
  Overall: 0 insns

Checking profitability of path (backwards):
  [1] Registering jump thread: (5, 3) incoming edge;  (3, 5) nocopy;
path: 5->3->5 SUCCESS
Merging blocks 2 and 3
Merging blocks 5 and 6
fix_loop_structure: fixing up loops for function
fix_loop_structure: removing loop 1
flow_loops_find: discovered new loop 2 with header 3

and we get correct profile:

void __show_backtrace (void * rw)
{
;;   basic block 2, loop depth 0, count 118111600 (estimated locally), maybe
hot
;;    prev block 0, next block 3, flags: (NEW, REACHABLE, VISITED)
;;    pred:       ENTRY [always]  count:118111600 (estimated locally)
(FALLTHRU,EXECUTABLE)
  if (rw_1(D) != 0B)
    goto <bb 3>; [0.00%]
  else
    goto <bb 4>; [100.00%]
;;    succ:       3 [never (guessed)]  count:0 (estimated locally)
(TRUE_VALUE,EXECUTABLE)
;;                4 [always (guessed)]  count:118111600 (estimated locally)
(FALSE_VALUE,EXECUTABLE)

;;   basic block 3, loop depth 1, count 955630224 (estimated locally), maybe
hot
;;    prev block 2, next block 4, flags: (NEW, REACHABLE, VISITED)
;;    pred:       2 [never (guessed)]  count:0 (estimated locally)
(TRUE_VALUE,EXECUTABLE)
;;                3 [always]  count:955630224 (estimated locally)
(FALLTHRU,DFS_BACK)
  goto <bb 3>; [100.00%]
;;    succ:       3 [always]  count:955630224 (estimated locally)
(FALLTHRU,DFS_BACK)

;;   basic block 4, loop depth 0, count 118111600 (estimated locally), maybe
hot
;;    prev block 3, next block 1, flags: (NEW, REACHABLE, VISITED)
;;    pred:       2 [always (guessed)]  count:118111600 (estimated locally)
(FALSE_VALUE,EXECUTABLE)
  return;
;;    succ:       EXIT [always]  count:118111600 (estimated locally)
(EXECUTABLE) q.c:4:1

}

Reply via email to