On Sun, Dec 14, 2025 at 1:18 PM Kugan Vivekanandarajah
<[email protected]> wrote:
>
> Hi,
>
> This patch shows up with AutoFDO but IMO this is not limited to AutoFDO.
>
> The bug is a stale Virtual SSA on calls to functions that have
> been marked const or pure.
>
> pure_const pass analyzes function rocksdb::y::y() and determines it has no 
> side
> effects and marks it as const.
>
> At this point, existing call sites to y::y() in other functions still have:
>    # .MEM_12 = VDEF <.MEM_11>   rocksdb::y::y (&l, _9);
>
> Exact ICE is:
> 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
> dump file: lru_cache_reduced.ii.076t.feedback_fnsplit1
> cache/lru_cache.cc:921:1: internal compiler error: verify_ssa failed
> 0x26f4073 internal_error(char const*, ...)
> ../../gcc-ro/gcc/diagnostic-global-context.cc:787
> 0x16f91df verify_ssa(bool, bool)
> ../../gcc-ro/gcc/tree-ssa.cc:1203
> 0x12f0643 execute_function_todo
> ../../gcc-ro/gcc/passes.cc:2104
> 0x12f0beb execute_todo
> ../../gcc-ro/gcc/passes.cc:2149
>
>
> In ipa-pure-const, we do execute_fixup_cfg only for the changed. IMO, we
> should call for all the functions that has this function called. Calling 
> fixup for all also fixes this ICE.
>
> Later in feedback_fnsplit SSA verification fails. Added fixup
> after execute_feedback_split_functions also fixes this ICE.
This looks ok to me except I would add a comment on why you need the
fixup and no reason for the todo variable either:

/* Update virtual SSA as some functions could have changed to be pure/const.  */
retval  |= execute_fixup_cfg ();
return retval;

Thanks,
Andrew

>
> gcc/ChangeLog:
>
> 2025-12-08  Kugan Vivekanandarajah  <[email protected]>
>
>         * ipa-split.cc (execute_feedback_split_functions): Call
>         * execute_fixup_cfg.
>
>
>
>

Reply via email to