[PATCH] D25813: [CodeGen] Devirtualize calls to methods marked final in a derived class
Vedant Kumar via cfe-commits
cfe-commits at lists.llvm.org
Wed Oct 19 22:42:40 PDT 2016
vsk created this revision.
vsk added reviewers: rjmccall, pcc.
vsk added a subscriber: cfe-commits.
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.
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 6647 bytes
Desc: not available
More information about the cfe-commits