> The third testcase uses anonymous namespaces and ipa-devirt correctly
> reports that its list of possible targets is final, but even though
> the list has only two items and one of them is __cxa_pure_virtual, it
> still only devirtualizes speculatively.

Ah, yes, it is what I was discussing this with Jason, but apparently the
disucssion died out.  According to his comment __cxa_pure_virtual is a
synonymum for undefined behaviour so it may be correct to unconditionally
devirtualize here (changing runtime beaviour from terminate() to random method
call), but at the moment we don't do that.  Somewhere back in my head I have
burned in from C++ lessons that calling pure virtual method should result in
terminate () call, so I am considering __cxa_pure_virtual to be legitimate call
target (as opposed to any non-function or __builtin_unreachable that I drop
from the list).

I would be happy to change this behaviour, since there are quite few extra
cases where we could devirtualize well then.

Honza

Reply via email to