Redo the fix Benjamin Kramer committed in r178793 about iterator invalidation in...
authorShuxin Yang <shuxin.llvm@gmail.com>
Mon, 8 Apr 2013 22:00:43 +0000 (22:00 +0000)
committerShuxin Yang <shuxin.llvm@gmail.com>
Mon, 8 Apr 2013 22:00:43 +0000 (22:00 +0000)
commit4fd00c55d0e31770505e6517afdfadfa3482d889
tree46abee0b92b95a4dc37fc8f4eca11b76e7854a7e
parentdf4381b578b291e1d1044f29ce4720b16ad0b12c
Redo the fix Benjamin Kramer committed in r178793 about iterator invalidation in Reassociate.

I brazenly think this change is slightly simpler than r178793 because:
  - no "state" in functor
  - "OpndPtrs[i]" looks simpler than "&Opnds[OpndIndices[i]]"

  While I can reproduce the probelm in Valgrind, it is rather difficult to come up
a standalone testing case. The reason is that when an iterator is invalidated,
the stale invalidated elements are not yet clobbered by nonsense data, so the
optimizer can still proceed successfully.

  Thank Benjamin for fixing this bug and generously providing the test case.

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