Re: Question on calling possible_polymorphic_call_targets, side effects, and virtual tables.

2021-10-27 Thread Jan Hubicka via Gcc
> Hello,
> 
> I have a SIMPLE_IPA_PASS that parses the program multiple times. As it
> parses gimple, it builds a data structure with the information
> collected that will provide some invariants to future iterations over
> the program.
> 
> I was looking into adding a new feature that would take advantage of
> devirtualization by calling possible_polymorphic_call_targets. All
> looks good, a large program that I use for verifying changes seems to
> compile nicely. However, as I generate a test file in which I discard
> most optimizations (except the one I am currently working on) I
> realize that an assertion on my pass is triggered.
> 
> I dig in and it looks like I am ignoring error_mark_nodes in varpools'
> DECL_INITIAL. The first passes essentially encode the information that
> these are error_mark_nodes. On the pass in which I call
> possible_polymorphic_call_targets I find that suddenly, these
> error_mark_nodes are gone and replaced with a virtual table, thus
> triggering the assertion.
> 
> Is there a way I can get rid of the error_mark_nodes from the earlier
> passes to match the changes brought by
> possible_polymorphic_call_targets? I suppose that finding
> polymorphic_call_targets at an earlier stage is a possibility, but I
> was wondering exactly which function/statement is able to fix these
> error_mark_nodes so that I can also learn about this.

Like function bodies the initializers are read on demand.
If you call get_constructor (varpool_node) you will trigger the lazy
stream in.

Honza
> 
> Thanks!


Question on calling possible_polymorphic_call_targets, side effects, and virtual tables.

2021-10-27 Thread Erick Ochoa via Gcc
Hello,

I have a SIMPLE_IPA_PASS that parses the program multiple times. As it
parses gimple, it builds a data structure with the information
collected that will provide some invariants to future iterations over
the program.

I was looking into adding a new feature that would take advantage of
devirtualization by calling possible_polymorphic_call_targets. All
looks good, a large program that I use for verifying changes seems to
compile nicely. However, as I generate a test file in which I discard
most optimizations (except the one I am currently working on) I
realize that an assertion on my pass is triggered.

I dig in and it looks like I am ignoring error_mark_nodes in varpools'
DECL_INITIAL. The first passes essentially encode the information that
these are error_mark_nodes. On the pass in which I call
possible_polymorphic_call_targets I find that suddenly, these
error_mark_nodes are gone and replaced with a virtual table, thus
triggering the assertion.

Is there a way I can get rid of the error_mark_nodes from the earlier
passes to match the changes brought by
possible_polymorphic_call_targets? I suppose that finding
polymorphic_call_targets at an earlier stage is a possibility, but I
was wondering exactly which function/statement is able to fix these
error_mark_nodes so that I can also learn about this.

Thanks!