OSDN Git Service

[ICP] Expose unconditional call promotion interface
authorMatthew Simpson <mssimpso@codeaurora.org>
Wed, 20 Dec 2017 19:26:37 +0000 (19:26 +0000)
committerMatthew Simpson <mssimpso@codeaurora.org>
Wed, 20 Dec 2017 19:26:37 +0000 (19:26 +0000)
commitb198d4ebde51c6fca0a11bf8f8dda90000352016
treeeb446dede73f07db8095919c8b41e4484bf92a0c
parent9d97dd42c1db24db46a879e5f3da3eff834f481e
[ICP] Expose unconditional call promotion interface

This patch modifies the indirect call promotion utilities by exposing and using
an unconditional call promotion interface. The unconditional promotion
interface (i.e., call promotion without creating an if-then-else) can be used
if it's known that an indirect call has only one possible callee. The existing
conditional promotion interface uses this unconditional interface to promote an
indirect call after it has been versioned and placed within the "then" block.

A consequence of unconditional promotion is that the fix-up operations for phi
nodes in the normal destination of invoke instructions are changed. This is
necessary because the existing implementation assumed that an invoke had been
versioned, creating a "merge" block where a return value bitcast could be
placed. In the new implementation, the edge between a promoted invoke's parent
block and its normal destination is split if needed to add a bitcast for the
return value. If the invoke is also versioned, the phi node merging the return
value of the promoted and original invoke instructions is placed in the "merge"
block.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@321210 91177308-0d34-0410-b5e6-96231b3b80d8
include/llvm/Transforms/Utils/CallPromotionUtils.h
lib/Transforms/Utils/CallPromotionUtils.cpp
test/Transforms/PGOProfile/icp_covariant_call_return.ll
test/Transforms/PGOProfile/icp_covariant_invoke_return.ll
test/Transforms/PGOProfile/icp_invoke.ll
test/Transforms/PGOProfile/icp_invoke_nouse.ll
test/Transforms/PGOProfile/icp_vararg.ll
test/Transforms/PGOProfile/indirect_call_promotion.ll