Separate the ICP total threshold and remaining threshold.
authorDehao Chen <dehao@google.com>
Fri, 28 Jul 2017 01:02:54 +0000 (01:02 +0000)
committerDehao Chen <dehao@google.com>
Fri, 28 Jul 2017 01:02:54 +0000 (01:02 +0000)
commitf4240b5b91b4b47d6f85dd20805dc08a0aae5f55
tree2647ca6811ed45c981ca04719046b54dc87e0180
parent8260d66556f262c9698cea8804234c50e06f5d0f
Separate the ICP total threshold and remaining threshold.

Summary: In the current implementation, isPromotionProfitable only checks if the call count to a direct target is no less than a certain percentage threshold of the remaining call counts that have not been promoted. This causes code size problems when the target count is small but greater than a large portion of remaining counts. E.g. target1 takes 99.9%, while target2 takes 0.1%. Both targets will be promoted and inlined, makes the function size too large, which potentially prevents it from further inlining into its callers. This patch adds another percentage threshold against the total indirect call count. If the target count needs to be no less than both thresholds in order to be promoted speculatively.

Reviewers: davidxl, tejohnson

Reviewed By: tejohnson

Subscribers: sanjoy, llvm-commits

Differential Revision: https://reviews.llvm.org/D35962

llvm-svn: 309345
llvm/include/llvm/Analysis/IndirectCallPromotionAnalysis.h
llvm/lib/Analysis/IndirectCallPromotionAnalysis.cpp
llvm/test/Transforms/PGOProfile/indirect_call_promotion.ll