[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)
commit10280dac1dad5f182ef8a2bde0ee543b246b1599
tree2162a5296538d5ff25833782adb0ed170d446f33
parentabfc069d6ca23d96babe56b97581061000a5779b
[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.

llvm-svn: 211673
llvm/lib/Transforms/Scalar/LICM.cpp
llvm/test/Transforms/LICM/extra-copies.ll [new file with mode: 0644]