Add Loop Sink pass to reverse the LICM based of basic block frequency.
authorDehao Chen <dehao@google.com>
Thu, 27 Oct 2016 16:30:08 +0000 (16:30 +0000)
committerDehao Chen <dehao@google.com>
Thu, 27 Oct 2016 16:30:08 +0000 (16:30 +0000)
commitb94c09baa058e57b1e931746745050e19785ef30
treea2d57bc5d38400fcb744b91d3cb49282db424056
parent9c9d9cdcf8e996455318bbe334d1d36622338b70
Add Loop Sink pass to reverse the LICM based of basic block frequency.

Summary: LICM may hoist instructions to preheader speculatively. Before code generation, we need to sink down the hoisted instructions inside to loop if it's beneficial. This pass is a reverse of LICM: looking at instructions in preheader and sinks the instruction to basic blocks inside the loop body if basic block frequency is smaller than the preheader frequency.

Reviewers: hfinkel, davidxl, chandlerc

Subscribers: anna, modocache, mgorny, beanz, reames, dberlin, chandlerc, mcrosier, junbuml, sanjoy, mzolotukhin, llvm-commits

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

llvm-svn: 285308
llvm/include/llvm/InitializePasses.h
llvm/include/llvm/LinkAllPasses.h
llvm/include/llvm/Transforms/Scalar.h
llvm/include/llvm/Transforms/Utils/LoopUtils.h
llvm/lib/Transforms/Scalar/CMakeLists.txt
llvm/lib/Transforms/Scalar/LICM.cpp
llvm/lib/Transforms/Scalar/LoopSink.cpp [new file with mode: 0644]
llvm/lib/Transforms/Scalar/Scalar.cpp
llvm/test/Transforms/LICM/loopsink.ll [new file with mode: 0644]
llvm/test/Transforms/LICM/sink.ll [new file with mode: 0644]