Hello,

On Mon, Feb 02 2026, Jan Hubicka wrote:
>> Hi,
>> 
>> with -fno-toplevel-reorder (and -fwhole-program), there apparently can
>> be local functions without any callers.  This is something that IPA-CP
>> does not like because its propagation verifier checks that local
>> functions do not end up with TOP in their lattices.  Therefore there
>> is an assert checking that all call-less unreachable functions have
>> been removed, which triggers in PR 106260 with these two options.
>> 
>> This patch detects the situation and marks the lattices as variable,
>> thus avoiding both the assert trigger and the verification failure.
>> 
>> Bootstrapped and tested on x86_64-linux.  OK for master and then all
>> active release branches?
>> 
>> Thanks,
>> 
>> Martin
>> 
>> 
>> gcc/ChangeLog:
>> 
>> 2022-07-13  Martin Jambor  <[email protected]>
>> 
>>      PR ipa/106260
>>      * ipa-cp.cc (initialize_node_lattices): Replace assert that there are
>>      callers with handling that situation when -fno-toplevel_reorder.
> -fno-toplevel-reorder
>> 
>> gcc/testsuite/ChangeLog:
>> 
>> 2022-07-13  Martin Jambor  <[email protected]>
>> 
>>      PR ipa/106260
>>      * g++.dg/ipa/pr106260.C: New test.
>
> The patch is OK. -fno-toplevel-reorder behaviour is bit strange
> wrt function signature change (it is supposed to keep the symbols
> around, but if we propagate knowledge into them, they will not have the
> desired semantic), but it is mostly compatibility flag...
>

Thanks, I have checked it still bootstraps and tests fine and pushed it
to master.  I plan to backport it to the active release branches over
the upcoming weeks too.

Martin

Reply via email to