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

--- Comment #6 from Aldy Hernandez <aldyh at gcc dot gnu.org> ---
Hmm, all these threads look correct.  Following are my steps for verification.

In a stage2 compiler I do:

$ rm -f gimplify.o
$ make cc1 CXXFLAGS="-O2 -fdisable-tree-threadfull2 -fdisable-tree-threadfull1
-fdisable-tree-thread2 -fdisable-tree-thread1
-fdbg-cnt=registered_jump_thread:543-543:544-544:550-550:551-551:552-552:553-553:554-554:555-555
-fdump-tree-all-details --param=threader-debug=all"
$ ./cc1 a.c -O2 -fopenmp -quiet
a.c: In function ‘foo’:
a.c:35:13: internal compiler error: Segmentation fault
...
...

This disables all the threaders except DOM and ethread.  It also splits up the
individual threaded paths for easy grepping in the source (dbgcnt.*543,
dbgcnt.*544, etc).  All of the threads are needed to reproduce.  All of them
are from ethread and belong to the gimplify_scan_omp_clauses function:

$ grep Register.*jump gimplify.c.*
gimplify.c.034t.ethread:  [543] Registering jump thread: (687, 689) incoming
edge;  (689, 690) nocopy; 
gimplify.c.034t.ethread:  [544] Registering jump thread: (688, 689) incoming
edge;  (689, 693) nocopy; 
gimplify.c.034t.ethread:  [550] Registering jump thread: (776, 777) incoming
edge;  (777, 801) nocopy; 
gimplify.c.034t.ethread:  [551] Registering jump thread: (779, 780) incoming
edge;  (780, 781) nocopy; 
gimplify.c.034t.ethread:  [552] Registering jump thread: (780, 782) incoming
edge;  (782, 785) nocopy; 
gimplify.c.034t.ethread:  [553] Registering jump thread: (784, 786) incoming
edge;  (786, 787) nocopy; 
gimplify.c.034t.ethread:  [554] Registering jump thread: (785, 786) incoming
edge;  (786, 788) nocopy; 
gimplify.c.034t.ethread:  [555] Registering jump thread: (804, 806) incoming
edge;  (806, 807) nocopy; 

All of these paths, with the exception of 551 are trivially solvable.  For
example:

The IL immediate above this...

***dbgcnt: lower limit 543 reached for registered_jump_thread.***
***dbgcnt: upper limit 543 reached for registered_jump_thread.***
  [543] Registering jump thread: (687, 689) incoming edge;  (689, 690) nocopy; 
path: 687->689->690 SUCCESS

...is the path:

    <bb 689> :
    # iftmp.2344_1598 = PHI <1(687), 0(688)>
    if (iftmp.2344_1598 != 0)
      goto <bb 690>; [INV]
    else
      goto <bb 693>; [INV]

That's an obvious thread from 687->689->690.

The rest are a similar pattern.  The only different path is:

***dbgcnt: lower limit 551 reached for registered_jump_thread.***
***dbgcnt: upper limit 551 reached for registered_jump_thread.***
  [551] Registering jump thread: (779, 780) incoming edge;  (780, 781) nocopy; 
path: 779->780->781 SUCCESS

with an IL of:

    <bb 780> :
    # iftmp.2373_1603 = PHI <outer_ctx_1871(778), ctx_1868(779)>
    if (iftmp.2373_1603 != 0B)
      goto <bb 781>; [INV]
    else
      goto <bb 782>; [INV]

but if you look at the definition of ctx_1868, it's clear it's threadable to
bb781 because ctx_1868 is known to be non-zero:

  ctx_1868 = new_omp_context (region_type_1866(D));
  ctx_1868->code = code_1869(D);

Those are all the jump threads in play and they're all correct.

Reply via email to