[PATCH] D17864: [PGO] Promote indirect calls to conditional direct calls with value-profile
Rong Xu via llvm-commits
llvm-commits at lists.llvm.org
Thu Mar 3 12:30:11 PST 2016
xur created this revision.
xur added reviewers: davidxl, ivanbaev.
xur added a subscriber: llvm-commits.
Herald added a subscriber: joker.eph.
This patch implements the transformation that promotes indirect calls to conditional direct calls when the indirect-call value profile meta-data is available.
It is invoked in two places: (1) after the IR-level profile-use pass. (2) in LTO optimizations. (1) performs limited promotion as many of the targets are in other modules. (2) is capable of promoting all the targets.
The Transformation performs legality check and profitability check. Legality check mainly for corrupted profiles where the ic-targets can points to wrong targets. Profitability check currently only uses the counts value and the ratio b/w this target and total indirect-call count.
We stress-tested the transformation with SPEC2006 to promote all the indirect-targets in the value profiles (in lto compilation).
We haven yet to do a thorough performance tuning. Here is the initial performance numbers with some SPEC programming running (10-run average on an ibis_sandybridge machine).
`` (1) (2) (3) (4)
spec/2006/fp/C++/453.povray 42.05 -8.17% +3.72% +2.32%
spec/2006/int/C++/471.omnetpp 23.69 -3.41% +3.37% +1.27%
spec/2006/int/C++/473.astar 23.04 -1.49% +1.91% +1.68%
spec/2006/int/C++/483.xalancbmk 38.83 -1.91% +6.01% +4.99%
spec/2000/int/C++/252.eon 4999 -14.47% +4.84% +2.36%``
(1) PGO + LTO
(2) PGO
(3) PGO + LTO + ICP(Indirect Call Promotion)
(4) PGO + LTO + ICP(only promote 1 target)
One known issue to be fixed later:
code duplication (like unroll) b/w value profile annotation and value profile transformation blindly duplicates the counts in the VP metadata. Need to update the metadata copying.
http://reviews.llvm.org/D17864
Files:
include/llvm/IR/InstrTypes.h
include/llvm/InitializePasses.h
include/llvm/LinkAllPasses.h
include/llvm/ProfileData/InstrProf.h
include/llvm/Transforms/Instrumentation.h
lib/IR/Instructions.cpp
lib/ProfileData/InstrProf.cpp
lib/Transforms/IPO/PassManagerBuilder.cpp
lib/Transforms/Instrumentation/Instrumentation.cpp
lib/Transforms/Instrumentation/PGOInstrumentation.cpp
test/Transforms/PGOProfile/indirect_call_annotation.ll
test/Transforms/PGOProfile/indirect_call_promotion.ll
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D17864.49766.patch
Type: text/x-patch
Size: 26795 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160303/748f5ab4/attachment.bin>
More information about the llvm-commits
mailing list