https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104457
Bug ID: 104457 Summary: ipa-cp with autofdo: internal compiler error in update_specialized_profile, at ipa-cp.c:4422 Product: gcc Version: 10.3.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: ipa Assignee: unassigned at gcc dot gnu.org Reporter: yancheng.li at foxmail dot com CC: marxin at gcc dot gnu.org Target Milestone: --- ******************************************************************************* OS and Platform: openEuler 20.03 LTS SP2, AARCH64 ******************************************************************************* GCC version: # gcc -v Using built-in specs. COLLECT_GCC=/bin/gcc COLLECT_LTO_WRAPPER=/libexec/gcc/aarch64-linux-gnu/10.3.0/lto-wrapper Target: aarch64-linux-gnu Configured with: ../gcc/configure --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --with-linker-hash-style=gnu --enable-languages=c,c++,objc,obj-c++,fortran,lto --enable-plugin --enable-initfini-array --disable-libgcj --without-isl --without-cloog --enable-gnu-indirect-function --build=aarch64-linux-gnu --with-stage1-ldflags=' -Wl,-z,relro,-z,now' --with-boot-ldflags=' -Wl,-z,relro,-z,now' --with-multilib-list=lp64 Thread model: posix Supported LTO compression algorithms: zlib gcc version 10.3.0 (GCC) ******************************************************************************* Reproduce: This ICE occurs when using AutoFDO to optimize SPECCPU2017 502,reproduce it as following: SPECCPU2017 502 optimization flag: -O2 -g Step 1: perf # runcpu -a run --rebuild 502 -n 1 # perf record -e inst_retired:up -o pmu.data -- runcpu -a run --nobuild 502 -n 1 Step 2: collect profile # create_gcov --binary=$SPEC/output/benchspec/CPU/557.xz_r/exe/xz_r_base --profile=pmu.data --gcov=502.gcov -gcov_version=1 -use_lbr=0 Step 3: reproduce SPECCPU2017 502 optimization flag: -O2 -g -fauto-profile=502.gcov # runcpu -a run --rebuild 502 -n 1 ******************************************************************************* c-parser.c:8724: internal compiler error: in update_specialized_profile, at ipa-cp.c:4422 0x132d657 update_specialized_profile ../../gcc/gcc/ipa-cp.c:4422 0x1337583 perhaps_add_new_callers<tree_node*> ../../gcc/gcc/ipa-cp.c:5347 0x1337583 decide_about_value<tree_node*> ../../gcc/gcc/ipa-cp.c:5454 0x1338e4f decide_whether_version_node ../../gcc/gcc/ipa-cp.c:5550 0x1338e4f ipcp_decision_stage ../../gcc/gcc/ipa-cp.c:5732 0x1338e4f ipcp_driver ../../gcc/gcc/ipa-cp.c:5915 0x1338e4f execute ../../gcc/gcc/ipa-cp.c:5990 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. ******************************************************************************* Thinking: In gcc/ipa.cp:4361 orig_node_count = (orig_sum + new_sum).apply_scale (12, 10); it seems that wrong orig_node_count has processed, but orig_new_node_count not processed at the same time, this may be the cause of the ICE?