On 12/12/2017 11:57 AM, Jakub Jelinek wrote:
> Hi!
> 
> We ICE on the following testcase, because we first gather all cgraph nodes
> in an array and then we walk it backwards and flatten_function anything
> that has "flatten" attribute.  But flatten_function can result in cgraph
> node removal and so we then try to dereference removed cgraph nodes.
> 
> From the array we are only interested in nodes with flatten attribute, so
> the patch ignores all other nodes (thus the common case of no flatten
> attributes in the TU is fast) by keeping them at the end of the order array
> only, and if we have at least 2 nodes to flatten, we additionally register
> a removal hook just in case a flatten node would be removed (the testcase
> has a non-flatten node removed only).  
> 
> Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?
> 
> 2017-12-12  Jakub Jelinek  <ja...@redhat.com>
> 
>       PR ipa/82801
>       * ipa-inline.c (flatten_remove_node_hook): New function.
>       (ipa_inline): Keep only nodes with flatten attribute at the end of
>       the array in the order from ipa_reverse_postorder, only walk that
>       portion of array for flattening, if there is more than one such
>       node, temporarily register a removal hook and ignore removed nodes.
> 
>       * g++.dg/ipa/pr82801.C: New test.
OK.  Make sure to reference 83346 in the ChangeLog entry.

jeff

Reply via email to