mirror of
https://github.com/RPCS3/llvm.git
synced 2024-12-13 23:18:58 +00:00
Decrementing the iterator here could be wrong if the worklist is empty after the "erase".
Thanks to Ji Young Park for the patch! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56316 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
3d0a9a371c
commit
670ed09238
@ -111,11 +111,12 @@ bool DCE::runOnFunction(Function &F) {
|
||||
|
||||
// Remove the instruction from the worklist if it still exists in it.
|
||||
for (std::vector<Instruction*>::iterator WI = WorkList.begin();
|
||||
WI != WorkList.end(); ++WI)
|
||||
if (*WI == I) {
|
||||
WI != WorkList.end(); ) {
|
||||
if (*WI == I)
|
||||
WI = WorkList.erase(WI);
|
||||
--WI;
|
||||
}
|
||||
else
|
||||
++WI;
|
||||
}
|
||||
|
||||
MadeChange = true;
|
||||
++DCEEliminated;
|
||||
|
Loading…
Reference in New Issue
Block a user