https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107661
--- Comment #10 from Sergei Trofimovich <slyfox at gcc dot gnu.org> --- I think ipa-cp adds the call edge info in wrong direction. a.cc.081i.cp snippet around do3() param1 (our callback): IPA lattices after all propagation: Lattices: ... Node: void do3(volatile int*, function_ref)/25: ... param [1]: VARIABLE ctxs: VARIABLE Bits unusable (BOTTOM) [irange] int VARYING offset 0: callback_fn_L [scc: 3, from: 25(0.330000) 26(1.000000)] [loc_time: 17, loc_size: 13, prop_time: 17, prop_size: 13] callback_fn_R [scc: 4, from: 25(0.330000) 26(1.000000)] [loc_time: 9, loc_size: 13, prop_time: 9, prop_size: 13] ... Evaluating opportunities for void do3(volatile int*, function_ref)/25. - considering value callback_fn_L for param #1 Expired, offset: 0 (caller_count: 2) good_cloning_opportunity_p (time: 17, size: 13, freq_sum: 1.33, self_scc) -> evaluation: 1739.23, threshold: 500 Creating a specialized node of void do3(volatile int*, function_ref)/25. the new node is void do3.constprop(volatile int*, function_ref)/33. Aggregate replacements: 1[0]=callback_fn_L ipa-prop: Discovered an indirect call to a known target (void do3.constprop(volatile int*, function_ref)/33 -> void callback_fn_L()/15), for stmt _1 (); ../a.cc:37:19: optimized: converting indirect call in void do3.constprop(volatile int*, function_ref)/33 to direct call to void callback_fn_L()/15 Evaluating opportunities for void do3(volatile int*, function_ref)/25. - adding an extra caller void do3(volatile int*, function_ref)/25 of void do3.constprop(volatile int*, function_ref)/33 Note: the uncloned do3() is a self-recursive function. I would expect cloned do3.constprop() to refer to uncloned do3(). If I read "adding an extra caller" correctly it adds an edge in wrong direction: do3() now calls do3.constptop().