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

--- Comment #7 from Richard Biener <rguenth at gcc dot gnu.org> ---
(In reply to Andrew Pinski from comment #5)
>   __atomic_fetch_add_8 (&__gcov0._ZN1g1iE1a[2], 1, 0);
> 
> I wonder what the type of __gcov0._ZN1g1iE1a is.

It's correct.

 <var_decl 0x7ffff698d360 __gcov0._ZN1g1iE1a
    type <array_type 0x7ffff6990150
        type <integer_type 0x7ffff682b738 long int public DI
            size <integer_cst 0x7ffff680de28 constant 64>
            unit-size <integer_cst 0x7ffff680de40 constant 8>
            align:64 warn_if_not_align:0 symtab:0 alias-set -1 canonical-type
0x7ffff682b738 precision:64 min <integer_cst 0x7ffff682f0c0
-9223372036854775808> max <integer_cst 0x7ffff682f0d8 9223372036854775807>
            pointer_to_this <pointer_type 0x7ffff683c540>>
        BLK
        size <integer_cst 0x7ffff682f198 constant 256>
        unit-size <integer_cst 0x7ffff682f288 constant 32>
        align:64 warn_if_not_align:0 symtab:0 alias-set -1 canonical-type
0x7ffff6990150
        domain <integer_type 0x7ffff69900a8 type <integer_type 0x7ffff682b000
sizetype>
            DI size <integer_cst 0x7ffff680de28 64> unit-size <integer_cst
0x7ffff680de40 8>
            align:64 warn_if_not_align:0 symtab:0 alias-set -1 canonical-type
0x7ffff69900a8 precision:64 min <integer_cst 0x7ffff680de58 0> max <integer_cst
0x7ffff698c270 3>>>
    addressable nothrow static BLK <built-in>:0:0 size <integer_cst
0x7ffff682f198 256> unit-size <integer_cst 0x7ffff682f288 32>
    align:256 warn_if_not_align:0>

I think the issue is with inliner predicates.  The unreachable is added via

#1  0x00000000010e52c3 in redirect_to_unreachable (
    e=<cgraph_edge* 0x7ffff69910d0 (<cgraph_node * 0x7ffff680f708 "i"/4> ->
<cgraph_node * 0x7ffff680f9d8 "__atomic_fetch_add_8"/13>)>)
    at /space/rguenther/src/gcc-9-branch/gcc/ipa-fnsummary.c:236
#2  0x00000000010e53fe in edge_set_predicate (
    e=<cgraph_edge* 0x7ffff69910d0 (<cgraph_node * 0x7ffff680f708 "i"/4> ->
<cgraph_node * 0x7ffff680f9d8 "__atomic_fetch_add_8"/13>)>, 
    predicate=0x7fffffffc350)
    at /space/rguenther/src/gcc-9-branch/gcc/ipa-fnsummary.c:267
#3  0x00000000010ee97b in remap_edge_summaries (
    inlined_edge=<cgraph_edge* 0x7ffff6818a28 (<cgraph_node * 0x7ffff680f870
"test"/5> -> <cgraph_node * 0x7ffff680f708 "i"/4>)>, 
    node=<cgraph_node * 0x7ffff680f708 "i"/4>, info=0x7ffff69917b8, 
    callee_info=0x7ffff6991820, operand_map=..., offset_map=..., 
    possible_truths=0, toplev_predicate=0x7fffffffc490)
    at /space/rguenther/src/gcc-9-branch/gcc/ipa-fnsummary.c:2951
#4  0x00000000010ef369 in ipa_merge_fn_summary_after_inlining (
    edge=<cgraph_edge* 0x7ffff6818a28 (<cgraph_node * 0x7ffff680f870 "test"/5>
-> <cgraph_node * 0x7ffff680f708 "i"/4>)>)
    at /space/rguenther/src/gcc-9-branch/gcc/ipa-fnsummary.c:3101
#5  0x0000000002257d95 in inline_call (
    new_edges=0x7fffffffd6a8, overall_size=0x339e5b0 <overall_size>, 
    update_overall_summary=true, callee_removed=0x0)
    at /space/rguenther/src/gcc-9-branch/gcc/ipa-inline-transform.c:448
#6  0x0000000002248e5b in inline_small_functions ()
    at /space/rguenther/src/gcc-9-branch/gcc/ipa-inline.c:2074
#7  0x000000000224a8a0 in ipa_inline ()
    at /space/rguenther/src/gcc-9-branch/gcc/ipa-inline.c:2536
#8  0x000000000224b74d in (anonymous namespace)::pass_ipa_inline::execute (
    this=0x33fa340) at /space/rguenther/src/gcc-9-branch/gcc/ipa-inline.c:2944

for

$1 = <cgraph_edge* 0x7ffff69910d0 (<cgraph_node * 0x7ffff680f708 "i"/4> ->
<cgraph_node * 0x7ffff680f9d8 "__atomic_fetch_add_8"/13>)>

and likely the __builtin_constant_p handling.

Something for Honza to debug.  Honza?

Reply via email to