Reapply commit 158073 with a fix (the testcase was already committed). The
authorDuncan Sands <baldrick@free.fr>
Fri, 8 Jun 2012 20:15:33 +0000 (20:15 +0000)
committerDuncan Sands <baldrick@free.fr>
Fri, 8 Jun 2012 20:15:33 +0000 (20:15 +0000)
commit841f42617531ff947b2d957e7b0cb367a290aae4
treed170a883ea55fa49cc839e0a965de1445e015936
parent16b16ac8408f2d775db2110451877e5920032b8c
Reapply commit 158073 with a fix (the testcase was already committed).  The
problem was that by moving instructions around inside the function, the pass
could accidentally move the iterator being used to advance over the function
too.  Fix this by only processing the instruction equal to the iterator, and
leaving processing of instructions that might not be equal to the iterator
to later (later = after traversing the basic block; it could also wait until
after traversing the entire function, but this might make the sets quite big).
Original commit message:

Grab-bag of reassociate tweaks.  Unify handling of dead instructions and
instructions to reoptimize.  Exploit this to more systematically eliminate
dead instructions (this isn't very useful in practice but is convenient for
analysing some testcase I am working on).  No need for WeakVH any more: use
an AssertingVH instead.

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