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

Martin Liška <marxin at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |hubicka at gcc dot gnu.org,
                   |                            |mjambor at suse dot cz

--- Comment #5 from Martin Liška <marxin at gcc dot gnu.org> ---
Reduced test-case for x86_64:

$ !$omp parallel  
!$omp single
  call a
!$omp end single
!$omp end parallel
contains
  subroutine b (c, d, e, f, g, h, i, j, k, m)
    character (*) c
    character  d
    integer, dimension (m) :: e
    integer, dimension (m) :: f
    character  g
    character  h
    real, dimension (:, :, :) :: i
    double precision, dimension (:, :, :) :: j
    integer, dimension (:, :, :) :: k

    integer, dimension (m) :: l
!$omp task firstprivate (k) firstprivate (l)
    !$omp end task
  c = ''
  end  
  subroutine a
    character  c
    character  d
    integer, dimension (7) :: e
    integer, dimension (7) :: f
    character g
    character h
    real, dimension (5, 6, 7) :: i
    double precision, dimension (6, 6, 7) :: j
    integer, dimension (5, 7, 6) :: k
    call b (c, d, e, f, g, h, i, j, k, 7)
  end  
end

$ ./xgcc -B. ~/Programming/testcases/god.f90 -c -std=legacy -O1 -fexceptions
-fipa-cp -fnon-call-exceptions -fopenmp -fno-inline-functions-called-once
b.2041.constprop.1/15 (b.constprop) @0x7ffff6c65e60
  Type: function definition analyzed
  Visibility: artificial
  References: 
  Referring: 
  Availability: local
  First run: 0
  Function flags: count: 1073741826 (estimated locally) body local
  Called by: a/0 (1073741825 (estimated locally),1.00 per call) (can throw
external) 
  Calls: __builtin_memset/12 (445388109 (estimated locally),0.41 per call)
__builtin_free/14 (0,0.00 per call) 
during IPA pass: inline
/home/marxin/Programming/testcases/god.f90:7:0: internal compiler error:
verify_cgraph_node failed
0xaa864f cgraph_node::verify_node()
        ../../gcc/cgraph.c:3555
0xa95d17 symtab_node::verify()
        ../../gcc/symtab.c:1204
0x1110c0f optimize_inline_calls(tree_node*)
        ../../gcc/tree-inline.c:5086
0x1a2e4ee inline_transform(cgraph_node*)
        ../../gcc/ipa-inline-transform.c:682
0xf2aba1 execute_one_ipa_transform_pass
        ../../gcc/passes.c:2239
0xf2ad2b execute_all_ipa_transforms()
        ../../gcc/passes.c:2281
0xab5abe cgraph_node::expand()
        ../../gcc/cgraphunit.c:2132
0xab612d expand_all_functions
        ../../gcc/cgraphunit.c:2275
0xab6c92 symbol_table::compile()
        ../../gcc/cgraphunit.c:2624
0xab6f06 symbol_table::finalize_compilation_unit()
        ../../gcc/cgraphunit.c:2717

We first create a constprop, so that following edge is cloned:

clonning: b/2->__builtin_free/14
# .MEM_19 = VDEF <.MEM_4(D)>
__builtin_memset (c_18(D), 32, _c.14_1);

and then after materialization we have following CFG:
  <bb 13> [local count: 1073741825]:
  if (1 != 0)
    goto <bb 14>; [41.48%]
  else
    goto <bb 15>; [58.52%]

  <bb 14> [local count: 445388109]:
  __builtin_memset (c_14(D), 32, _c.14_1);

then the if condition is folded away and we end up with:
<bb 3> [local count: 1073741825]:
_5 = 5;
_6 = 1;
_7 = 5;
_8 = 7;
_9 = 1;
_10 = 35;
_11 = 6;
_12 = 1;
_13 = 7;
__builtin_memset (c_14(D), 32, _c.14_1);
return;

and it's logical that count promotes from 445388109 -> 1073741825.
Is it something known? I consider it's related to fact the call is a call to
built-in.
Honza, Martin, any ideas?

Reply via email to