[PATCH] D16795: WholeProgramDevirt: introduce.

Peter Collingbourne via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 1 20:12:56 PST 2016


pcc created this revision.
pcc added reviewers: joker.eph, pete, chandlerc.
pcc added subscribers: llvm-commits, kcc, hans.
Herald added a subscriber: joker.eph.

This pass implements whole program optimization of virtual calls in cases
where we know (via bitset information) that the list of callee is fixed. This
includes the following:

- Single implementation devirtualization: if a virtual call has a single
  possible callee, replace all calls with a direct call to that callee.

- Virtual constant propagation: if the virtual function's return type is an
  integer <=64 bits and all possible callees are readnone, for each class and
  each list of constant arguments: evaluate the function, store the return
  value alongside the virtual table, and rewrite each virtual call as a load
  from the virtual table.

- Uniform return value optimization: if the conditions for virtual constant
  propagation hold and each function returns the same constant value, replace
  each virtual call with that constant.

- Unique return value optimization for i1 return values: if the conditions
  for virtual constant propagation hold and a single vtable's function
  returns 0, or a single vtable's function returns 1, replace each virtual
  call with a comparison of the vptr against that vtable's address.

http://reviews.llvm.org/D16795

Files:
  include/llvm/InitializePasses.h
  include/llvm/Transforms/IPO.h
  include/llvm/Transforms/IPO/PassManagerBuilder.h
  include/llvm/Transforms/IPO/WholeProgramDevirt.h
  include/llvm/Transforms/Utils/Evaluator.h
  lib/Transforms/IPO/CMakeLists.txt
  lib/Transforms/IPO/GlobalOpt.cpp
  lib/Transforms/IPO/IPO.cpp
  lib/Transforms/IPO/LowerBitSets.cpp
  lib/Transforms/IPO/PassManagerBuilder.cpp
  lib/Transforms/IPO/WholeProgramDevirt.cpp
  lib/Transforms/Utils/CMakeLists.txt
  lib/Transforms/Utils/Evaluator.cpp
  test/Transforms/WholeProgramDevirt/constant-arg.ll
  test/Transforms/WholeProgramDevirt/devirt-single-impl.ll
  test/Transforms/WholeProgramDevirt/uniform-retval.ll
  test/Transforms/WholeProgramDevirt/unique-retval.ll
  test/Transforms/WholeProgramDevirt/virtual-const-prop-begin.ll
  test/Transforms/WholeProgramDevirt/virtual-const-prop-end.ll
  test/tools/gold/X86/disable-verify.ll
  unittests/Transforms/IPO/CMakeLists.txt
  unittests/Transforms/IPO/WholeProgramDevirt.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D16795.46612.patch
Type: text/x-patch
Size: 123665 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160202/11b7dd0b/attachment.bin>


More information about the llvm-commits mailing list