[LoopUnswitch] Add block frequency analysis to recognize hot/cold regions
authorChen Li <meloli87@gmail.com>
Tue, 29 Sep 2015 05:03:32 +0000 (05:03 +0000)
committerChen Li <meloli87@gmail.com>
Tue, 29 Sep 2015 05:03:32 +0000 (05:03 +0000)
commit573624bfdfc95741e581d630296a91a7d1d039c2
tree0133be3ab129379d809160e30196af5c13c9fb56
parent763aee2082547bb28f8d54002f261466922e9951
[LoopUnswitch] Add block frequency analysis to recognize hot/cold regions

Summary: This patch adds block frequency analysis to LoopUnswitch pass to recognize hot/cold regions. For cold regions the pass only performs trivial unswitches since they do not increase code size, and for hot regions everything works as before. This helps to minimize code growth in cold regions and be more aggressive in hot regions. Currently the default cold regions are blocks with frequencies below 20% of function entry frequency, and it can be adjusted via -loop-unswitch-cold-block-frequency flag. The entire feature is controlled via -loop-unswitch-with-block-frequency flag and it is off by default.

Reviewers: broune, silvas, dnovillo, reames

Subscribers: davidxl, llvm-commits

Differential Revision: http://reviews.llvm.org/D11605

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@248777 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Transforms/Scalar/LoopUnswitch.cpp
test/Transforms/LoopUnswitch/cold-loop.ll [new file with mode: 0644]