[LICM] Don't create more than one copy of an instruction per loop exit block when...
authorEvgeniy Stepanov <eugeni.stepanov@gmail.com>
Wed, 25 Jun 2014 07:54:58 +0000 (07:54 +0000)
committerEvgeniy Stepanov <eugeni.stepanov@gmail.com>
Wed, 25 Jun 2014 07:54:58 +0000 (07:54 +0000)
commit98726c311b0dc19076bf242973d92ca1858febe7
tree4f05d831dd12a24b620b5d87772468891b8d8e99
parentaa2e057bc108c32529815afb8be4ef090acddd94
[LICM] Don't create more than one copy of an instruction per loop exit block when sinking.

Fixes exponential compilation complexity in PR19835, caused by
LICM::sink not handling the following pattern well:

f = op g
e = op f, g
d = op e
c = op d, e
b = op c
a = op b, c

When an instruction with N uses is sunk, each of its operands gets N
new uses (all of them - phi nodes). In the example above, if a had 1
use, c would have 2, e would have 4, and g would have 8.

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