Some reassociate optimizations create new instructions, which they insert just
authorDuncan Sands <baldrick@free.fr>
Wed, 27 Jun 2012 14:19:00 +0000 (14:19 +0000)
committerDuncan Sands <baldrick@free.fr>
Wed, 27 Jun 2012 14:19:00 +0000 (14:19 +0000)
commit2d5f8ca3d180832d168e59e2bf3d85317e86287d
tree7a246e2eee83dd669994e9699ce4e624d720407b
parent4acefe192f02849bcb2fd620a9f507c00d39a686
Some reassociate optimizations create new instructions, which they insert just
before the expression root.  Any existing operators that are changed to use one
of them needs to be moved between it and the expression root, and recursively
for the operators using that one.  When I rewrote RewriteExprTree I accidentally
inverted the logic, resulting in the compacting going down from operators to
operands rather than up from operands to the operators using them, oops.  Fix
this, resolving PR12963.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@159265 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Transforms/Scalar/Reassociate.cpp
test/Transforms/Reassociate/crash.ll