[SCEV] Fix PR22856.
authorSanjoy Das <sanjoy@playingwithpointers.com>
Fri, 13 Mar 2015 18:31:19 +0000 (18:31 +0000)
committerSanjoy Das <sanjoy@playingwithpointers.com>
Fri, 13 Mar 2015 18:31:19 +0000 (18:31 +0000)
commit011536a1cceaf8d7c0a967788c3e05f8cfff38d1
tree0ed323d8ba92c7502927cfe573a6991431de130c
parent5a70dd1d8286faa4713b60da7621094d892e2ffc
[SCEV] Fix PR22856.

Summary:
ScalarEvolutionExpander assumes that the header block of a loop is a
legal place to have a use for a phi node.  This is true only for phis
that are either in the header or dominate the header block, but it is
not true for phi nodes that are strictly internal to the loop body.

This change teaches ScalarEvolutionExpander to place uses of PHI nodes
in the basic block the PHI nodes belong to.  This is always legal, and
`hoistIVInc` ensures that the said position dominates `IsomorphicInc`.

Reviewers: atrick

Subscribers: llvm-commits

Differential Revision: http://reviews.llvm.org/D8311

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@232189 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Analysis/ScalarEvolutionExpander.cpp
test/Analysis/ScalarEvolution/pr22856.ll [new file with mode: 0644]