[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)
commit337d4d95c277d595b5b31d2b07f49070aea75011
tree11d9555ae5c0ddbf61a67c5004e13923c4ab0659
parentb42f3c03bfb0cb3d6d9d46e756853eac02eb6f01
[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

llvm-svn: 300989
llvm/include/llvm/Transforms/Scalar/ConstantHoisting.h
llvm/lib/Transforms/Scalar/ConstantHoisting.cpp
llvm/test/CodeGen/X86/constant-hoisting-bfi.ll [new file with mode: 0644]
llvm/test/CodeGen/X86/fold-tied-op.ll
llvm/test/Transforms/ConstantHoisting/X86/ehpad.ll