Hi, I went through some statistics on firefox build (it is a source combining many coding styles). I was basically curious where we do devirtualization. The result is:
Before inline (i.e. important devirtualization) 624 ssa-pre devirt 0 this is interaprocedural devirutalization happening during early FRE by propagating constant accesses into vtables entries. (i.e. not type based at all) 10 ssa-pre devirt2 0 this is type based intraprocedural analysis during early optimizations 177 ipa-prop devirt devirtualization in ipa-cp 243 ipa-cp inline devirt this is devirtualization happening at IPA stage during inlining After inline (i.e. devirtualization where we missed the chance to do something useful) 82 gimple-fold devirt 1 this is the gimple-fold function in question (it also run pre-inline but apparently always fail. I will try the proposed patch and sed updated stats tomorrow) 27 ipa-prop intra devirt 1 intraprocedural type based analysis 1569 ssa-pre devirt 1 this is interaprocedural devirutalization happening during late FRE (not type based) So overall type based analyssi accounts 430 devirtualizations pre-inline and 109 post inline. Low level propagation of vtable accesses gets 624 pre-inline and 1569 post inline. Obviously the post inline numbers shows that we miss majority of interesting cases. I hope we can noticeably improve this. I am re-building with the proposed change now. Honza