[PATCH] CodeGen: Devirtualize member calls on classes that are provably final.

Benjamin Kramer benny.kra at gmail.com
Sun Aug 25 10:38:04 PDT 2013


Hi rjmccall, rsmith,

The idea is as follows:
1. After CodeGenModule::Release is called we know that the AST is complete and we
   can compute which classes with internal linkage have no children.
2. Do a recursive AST visitation to find those classes. We do this lazily on the
   first attempt to emit a virtual call.
3. Now emit direct calls when the class whose member is called is in this list.

This is common in code bases with many anonymous namespaces and virtual calls,
such as LLVM. PR16984.

http://llvm-reviews.chandlerc.com/D1511

Files:
  lib/CodeGen/CGExprCXX.cpp
  lib/CodeGen/CodeGenModule.cpp
  lib/CodeGen/CodeGenModule.h
  test/CodeGenCXX/devirtualize-virtual-function-calls-internal-linkage.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D1511.1.patch
Type: text/x-patch
Size: 8041 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130825/24654f81/attachment.bin>


More information about the cfe-commits mailing list