[LICM] Make Loop ICM profile aware
authorWenlei He <aktoon@gmail.com>
Sun, 11 Aug 2019 06:05:35 +0000 (06:05 +0000)
committerWenlei He <aktoon@gmail.com>
Sun, 11 Aug 2019 06:05:35 +0000 (06:05 +0000)
commit7e71aa24bc0788690fea7f0d7eab400c6a784deb
tree4ea81a9f29b5cb2b8f2d69c254bd91e76cd4edbd
parentd664072dd5ec60a7ef944ad1de90b5b8761f003e
[LICM] Make Loop ICM profile aware

Summary:
Hoisting/sinking instruction out of a loop isn't always beneficial. Hoisting an instruction from a cold block inside a loop body out of the loop could hurt performance. This change makes Loop ICM profile aware - it now checks block frequency to make sure hoisting/sinking anly moves instruction to colder block.

Test Plan:

ninja check

Reviewers: asbirlea, sanjoy, reames, nikic, hfinkel, vsk

Reviewed By: asbirlea

Subscribers: fhahn, vsk, davidxl, xbolva00, hiraditya, llvm-commits

Tags: #llvm

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

llvm-svn: 368526
llvm/include/llvm/Transforms/Utils/LoopUtils.h
llvm/lib/Transforms/Scalar/LICM.cpp
llvm/test/Other/opt-O2-pipeline.ll
llvm/test/Other/opt-O3-pipeline.ll
llvm/test/Other/opt-Os-pipeline.ll
llvm/test/Other/pass-pipelines.ll
llvm/test/Transforms/LICM/sink.ll