https://gcc.gnu.org/bugzilla/show_bug.cgi?id=123019
Bug ID: 123019
Summary: Autfdo build is failing for afdo_vpt_for_early_inline
Product: gcc
Version: 16.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: gcov-profile
Assignee: unassigned at gcc dot gnu.org
Reporter: kugan at gcc dot gnu.org
Target Milestone: ---
With the attached gcoc and test.cc:
using -fauto-profile=test.gcov test.cc -O3
I am seeing
cache/lru_cache.cc:921:1: error: virtual definition of statement not up to date
# .MEM_12 = VDEF <.MEM_11>
rocksdb::y::y (&l, _9);
during GIMPLE pass: feedback_fnsplit
cache/lru_cache.cc:921:1: internal compiler error: verify_ssa failed
0x276ab87 internal_error(char const*, ...)
../../gcc/gcc/diagnostic-global-context.cc:787
0x16fc203 verify_ssa(bool, bool)
../../gcc/gcc/tree-ssa.cc:1203
0x12f530b execute_function_todo
../../gcc/gcc/passes.cc:2104
0x12f3c93 do_per_function
../../gcc/gcc/passes.cc:1696
0x12f551b execute_todo
../../gcc/gcc/passes.cc:2149
This is happening due to:
1, afdo_vpt_for_early_inline() creates speculative edge (call graph level)
2. redirect_call_stmt_to_callee() calls gimple_ic() to expand to GIMPLE
3. gimple_ic() tries to handle Virtual SSA
4. Direct call gets INLINED
5. Virtual SSA is now broken
Tested on aarch64-linux-gnu.