On Thu, Apr 2, 2020 at 5:36 AM bule <bu...@huawei.com> wrote: > > Hello, > > An Internal Compiler Error(ICE) is found in ipa-sra optimization pass when it > handle the argument of internal call svst3 for SVE. > > The problem comes from > gcc/testsuite/gcc.target/aarch64/sve/acle/asm/st2_bf16.c in the test suit, > which can be reduced to flowing code: > > #include <arm_sve.h> > #include<arm_bf16.h> > void st2_bf16_base (svbfloat16x3_t z1, svbool_t p0, bfloat16_t *x0, intptr_t > x1) { > svst3 (p0, x0, z1); > } > > Compiled with -march=armv8.2-a+sve -msve-vector-bits=256 -O2, it will result > in a segment fault in IPA-SRA: > > > [bule@localhost gcc10_fail]$ gcc st2_bf16.i -o st2_bf16.s -S > > -march=armv8.2-a+sve -msve-vector-bits=256 -O2 > > during IPA pass: sra > > st2_bf16.c: In function ‘st2_bf16_base’: > > st2_bf16.c:10:1: internal compiler error: Segmentation fault > > ...... /* omit some stack info here. */ ...... > > 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 > > ...... /* omit some stack info here. */ ...... > > Please submit a full bug report, > > with preprocessed source if appropriate. > > Please include the complete backtrace with any bug report. > > Details can be found in PR 94398. > Similar problem 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. > > Any suggestions?
I think internal calls should be handled like asms which means, lookig at the source a bit, instead of ISRA_CTX_ARG pass ISRA_CTX_LOAD to scan_expr_access. Martin? Richard. > > Thanks, > Bu Le