OSDN Git Service

[ConstHoisting] Add BFI in constanthoisting pass and select the best insertion
authorWei Mi <wmi@google.com>
Fri, 21 Apr 2017 15:50:16 +0000 (15:50 +0000)
committerWei Mi <wmi@google.com>
Fri, 21 Apr 2017 15:50:16 +0000 (15:50 +0000)
commita88bbf0e225973dcc282e70acb01a883f172ffec
treeabf50dc30fdec224d5cf068289c86a8c3065463d
parent4961912e73756f3e4136f9e12c354478065840aa
[ConstHoisting] Add BFI in constanthoisting pass and select the best insertion
places based on it.

Existing constant hoisting pass will merge a group of contants in a small range
and hoist the const materialization code to the common dominator of their uses.
However, if the uses are all in cold pathes, existing implementation may hoist
the materialization code from cold pathes to a hot place. This may hurt performance.
The patch introduces BFI to the pass and selects the best insertion places based
on it.

The change is controlled by an option consthoist-with-block-frequency which is
off by default for now.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300989 91177308-0d34-0410-b5e6-96231b3b80d8
include/llvm/Transforms/Scalar/ConstantHoisting.h
lib/Transforms/Scalar/ConstantHoisting.cpp
test/CodeGen/X86/constant-hoisting-bfi.ll [new file with mode: 0644]
test/CodeGen/X86/fold-tied-op.ll
test/Transforms/ConstantHoisting/X86/ehpad.ll