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

            Bug ID: 94434
           Summary: [AArch64][SVE] ICE caused by incompatibility of SRA
                    and svst3 builtin-function
           Product: gcc
           Version: 10.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: bule1 at huawei dot com
                CC: mjambor at suse dot cz
  Target Milestone: ---
            Target: aarch64

Created attachment 48154
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=48154&action=edit
patch for the problem

test case: gcc/testsuite/gcc.target/aarch64/sve/acle/asm/st2_bf16.c

Command line:gcc st2_bf16.c -march=armv8.2-a+sve -msve-vector-bits=256 -O2
-fno-diagnostics-show-caret -fno-diagnostics-show-line-numbers
-fdiagnostics-color=never -fdiagnostics-urls=never  -DTEST_OVERLOADS
-fno-ipa-icf -c -o st2_bf16.o
during IPA pass: sra
st2_bf16.c: In function ‘st2_vnum_bf16_x1’:
st2_bf16.c:198:1: internal compiler error: Segmentation fault
0xc995b3 crash_signal
        ../.././gcc/toplev.c:328
0xa34f68 hash_map<int_hash<int, 0, -1>, isra_call_summary*,
simple_hashmap_traits<default_hash_traits<int_hash<int, 0, -1> >,
isra_call_summary*> >::get_or_insert(int const&, bool*)
        ../.././gcc/hash-map.h:194
0xa34f68 call_summary<isra_call_summary*>::get_create(cgraph_edge*)
        ../.././gcc/symbol-summary.h:642
0xa34f68 record_nonregister_call_use
        ../.././gcc/ipa-sra.c:1613
0xa34f68 scan_expr_access
        ../.././gcc/ipa-sra.c:1781
0xa37627 scan_function
        ../.././gcc/ipa-sra.c:1880
0xa37627 ipa_sra_summarize_function
        ../.././gcc/ipa-sra.c:2505
0xa38437 ipa_sra_generate_summary
        ../.././gcc/ipa-sra.c:2555
0xbb58bb execute_ipa_summary_passes(ipa_opt_pass_d*)
        ../.././gcc/passes.c:2191
0x7f672f ipa_passes
        ../.././gcc/cgraphunit.c:2627
0x7f672f symbol_table::compile()
        ../.././gcc/cgraphunit.c:2737
0x7f89ab symbol_table::compile()
        ../.././gcc/cgraphunit.c:2717
0x7f89ab symbol_table::finalize_compilation_unit()
        ../.././gcc/cgraphunit.c:2984
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.

Similar problems can be found in svst2、svst4 and other functions of this kind.

This problem is cause by "record_nonregister_call_use" function trying to
access the call graph edge of an internal call, .MASK_STORE_LANE, which is a
NULL pointer.

The reason of stepping into "record_nonregister_call_use" function is that the
upper level function "scan_expr_access" considered the "svbfloat16x3_t z1"
argument as a valid candidate for further optimization.

A simple solution here is to disqualify the candidate at "scan_expr_access"
level when the call graph edge is null, which indicates the call is either an
internal call or a call with no references. For both case, the further
optimization process should stop before it reference a NULL pointer.

A proposed patch is attached.

Reply via email to