[PATCH] D28962: Add BFI in constanthoisting pass and do the hoisting selectively

Wei Mi via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 20 12:02:25 PST 2017


wmi created this revision.

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, we may hoist the materialization code from cold pathes to a hot place. This may hurt performance. The patch simply introduces BFI to the pass and does the hoisting only when the common dominator is colder than the sum of execution freq of all the uses to be merged.

Now usage of BFI is guarded by an option consthoist-with-block-frequency which is off by default.  I did the compile time evaluation using spec2006 when the option was on and the compile time increase was in noise range: about 0.5% on averange (ranged from -2% ~ 2% for the 21 C/C++ benchmarks).


Repository:
  rL LLVM

https://reviews.llvm.org/D28962

Files:
  include/llvm/Transforms/Scalar/ConstantHoisting.h
  lib/Transforms/Scalar/ConstantHoisting.cpp
  test/CodeGen/X86/constant-hoisting-bfi.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D28962.85169.patch
Type: text/x-patch
Size: 8238 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170120/61ed5506/attachment.bin>


More information about the llvm-commits mailing list