If we see a virtual method call to Base::foo() but can infer that the
object is an instance of Derived, and that 'foo' is marked 'final' in
Derived, we can devirtualize the call to Derived::foo().
Note: This patch introduces a check which depends on the result of
Base->getBestDynamicClassType(). Since this API can return nullptr, I
took the opportunity to defensively group together the checks which rely
on the result. I can drop this change, or try it in a separate commit if
that would be better.