[LPM] Apply a really big hammer to fix PR18688 by recursively reforming
authorChandler Carruth <chandlerc@gmail.com>
Sat, 1 Feb 2014 13:35:14 +0000 (13:35 +0000)
committerChandler Carruth <chandlerc@gmail.com>
Sat, 1 Feb 2014 13:35:14 +0000 (13:35 +0000)
commit115fd30b245065324193baefe418cd7e6b429488
treea0c11e583cac3f2a25dbee5d1a94167ebccc1520
parenta7bc25e34cf980e283bb0485d8882d4cd1bb377a
[LPM] Apply a really big hammer to fix PR18688 by recursively reforming
LCSSA when we promote to SSA registers inside of LICM.

Currently, this is actually necessary. The promotion logic in LICM uses
SSAUpdater which doesn't understand how to place LCSSA PHI nodes.
Teaching it to do so would be a very significant undertaking. It may be
worthwhile and I've left a FIXME about this in the code as well as
starting a thread on llvmdev to try to figure out the right long-term
solution.

For now, the PR needs to be fixed. Short of using the promition
SSAUpdater to place both the LCSSA PHI nodes and the promoted PHI nodes,
I don't see a cleaner or cheaper way of achieving this. Fortunately,
LCSSA is relatively lazy and sparse -- it should only update
instructions which need it. We can also skip the recursive variant when
we don't promote to SSA values.

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