Use a worklist to avoid a sneaky iterator invalidation.
authorBill Wendling <isanbard@gmail.com>
Tue, 2 Apr 2013 08:16:45 +0000 (08:16 +0000)
committerBill Wendling <isanbard@gmail.com>
Tue, 2 Apr 2013 08:16:45 +0000 (08:16 +0000)
commit2b7923665d628c247fcc50c52d7e0618359491c6
tree840b9c719ef5dffe0f102c753871f87afd962656
parent61ed5ddefe96cb6cb689fbcc74f95cfa00f493a1
Use a worklist to avoid a sneaky iterator invalidation.

The iterator could be invalidated when it's recursively deleting a whole bunch
of constant expressions in a constant initializer.

Note: This was only reproducible if `opt' was run on a `.bc' file. If `opt' was
run on a `.ll' file, it wouldn't crash. This is why the test first pushes the
`.ll' file through `llvm-as' before feeding it to `opt'.

PR15440

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@178531 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Transforms/IPO/GlobalOpt.cpp
test/Transforms/GlobalOpt/crash-2.ll [new file with mode: 0644]