projects
/
oota-llvm.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
3d0a9a3
)
Decrementing the iterator here could be wrong if the worklist is empty after the...
author
Bill Wendling
<isanbard@gmail.com>
Thu, 18 Sep 2008 23:04:18 +0000
(23:04 +0000)
committer
Bill Wendling
<isanbard@gmail.com>
Thu, 18 Sep 2008 23:04:18 +0000
(23:04 +0000)
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
lib/Transforms/Scalar/DCE.cpp
patch
|
blob
|
history
diff --git
a/lib/Transforms/Scalar/DCE.cpp
b/lib/Transforms/Scalar/DCE.cpp
index cb78207d760bc0d9b82bc1e01fee2ea63fced7de..fb9a0e04fd6243a9380f2d2f0f902cbb8790854a 100644
(file)
--- a/
lib/Transforms/Scalar/DCE.cpp
+++ b/
lib/Transforms/Scalar/DCE.cpp
@@
-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;