https://gcc.gnu.org/bugzilla/show_bug.cgi?id=123888

--- Comment #25 from Jan Hubicka <hubicka at ucw dot cz> ---
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=123888
> 
> --- Comment #24 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
> _ZN7mozilla3net13nsStandardURL16TemplatedMutatorIS1_E4InitEjiRK12nsTSubstringIcEPKcP6nsIURIPP13nsIURIMutator
> (whose thunk is the speculated call on one of the OBJ_TYPE_REF calls in
> NewStandardURI) is clearly const propagated, because
>   return NS_MutateURI(new nsStandardURL::Mutator())
>       .Apply(&nsIStandardURLMutator::Init, nsIStandardURL::URLTYPE_AUTHORITY,
>              aDefaultPort, aSpec, aCharset, aBaseURI, nullptr)
>       .Finalize(aURI);
> passes NULL to it as the last argument (i.e. aMutator).
> And during wpa I see redirect_to_unreachable being called when
> _ZN7mozilla3net13nsStandardURL16TemplatedMutatorIS1_E4InitEjiRK12nsTSubstringIcEPKcP6nsIURIPP13nsIURIMutator
> is being cloned to
> _ZN7mozilla3net13nsStandardURL16TemplatedMutatorIS1_E4InitEjiRK12nsTSubstringIcEPKcP6nsIURIPP13nsIURIMutator.constprop.0
> but unsure why, during
> #0  redirect_to_unreachable (e=0x7fffe7462888) at
> ../../gcc/ipa-fnsummary.cc:263
> #1  0x000000000099bdf7 in edge_set_predicate (e=0x7fffe7462888,
> predicate=0x7ffffffeb140) at ../../gcc/ipa-fnsummary.cc:300
> #2  0x000000000099e2ba in ipa_fn_summary_t::duplicate (this=0x7fffe7b7eb60,
> src=0x7fffe81e9550, dst=0x7fffe8040770, src_info=0x7fffe781ddc0,
> info=0x7fffe7fb8b58)
>     at ../../gcc/ipa-fnsummary.cc:939
> #3  0x00000000009b1fe0 in fast_function_summary<ipa_fn_summary*,
> va_gc>::symtab_duplication (node=0x7fffe81e9550, node2=0x7fffe8040770,
> data=0x7fffe7b7eb60)
>     at ../../gcc/symbol-summary.h:509
> #4  0x0000000000587bf9 in symbol_table::call_cgraph_duplication_hooks
> (this=0x7fffe9806000, node=0x7fffe81e9550, node2=0x7fffe8040770) at
> ../../gcc/cgraph.cc:650
> #5  0x00000000005a72a8 in cgraph_node::create_virtual_clone
> param_adjustments=0x7fffe7cb9480, 
>     suffix=0x4e38ee9 "constprop", num_suffix=0) at
> ../../gcc/cgraphclones.cc:746
> #6  0x000000000384797f in create_specialized_node (node=0x7fffe81e9550,
> known_csts=..., known_contexts=..., aggvals=0x0, callers=...) at
> ../../gcc/ipa-cp.cc:5188
> the src->indirect_calls edges have NULL callee rather than unreachable.

This code is updating summary for ipa-cp clone and doing that it folds
predicates for a given context (newly known constants/value ranges).  If
predicate folds to false (as it does here), all calls (direct or
indirect) are marked as unreachable so the inliner/ipacp heuristics does
not try to otimize acorss them.

So there should be a constnat propagation that implies makes predicat
false and if the call is still reachable in real code, there is some bug
in that.

I am going back from winter school today so I will try to reproduce it
myself.

Honza

Reply via email to