projects
/
oota-llvm.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Resurrect r191017 " GVN proceeds in the presence of dead code" plus a fix to PR17307...
[oota-llvm.git]
/
lib
/
Transforms
/
Scalar
/
DCE.cpp
diff --git
a/lib/Transforms/Scalar/DCE.cpp
b/lib/Transforms/Scalar/DCE.cpp
index 086f0a1a714bad1f94c3665fe88800feba806eb8..e8a090af40c316f1d3d09b53d00b926f67b633aa 100644
(file)
--- a/
lib/Transforms/Scalar/DCE.cpp
+++ b/
lib/Transforms/Scalar/DCE.cpp
@@
-18,12
+18,12
@@
#define DEBUG_TYPE "dce"
#include "llvm/Transforms/Scalar.h"
#define DEBUG_TYPE "dce"
#include "llvm/Transforms/Scalar.h"
-#include "llvm/
Transforms/Utils/Local
.h"
-#include "llvm/Instruction.h"
+#include "llvm/
ADT/Statistic
.h"
+#include "llvm/I
R/I
nstruction.h"
#include "llvm/Pass.h"
#include "llvm/Support/InstIterator.h"
#include "llvm/Target/TargetLibraryInfo.h"
#include "llvm/Pass.h"
#include "llvm/Support/InstIterator.h"
#include "llvm/Target/TargetLibraryInfo.h"
-#include "llvm/
ADT/Statistic
.h"
+#include "llvm/
Transforms/Utils/Local
.h"
using namespace llvm;
STATISTIC(DIEEliminated, "Number of insts removed by DIE pass");
using namespace llvm;
STATISTIC(DIEEliminated, "Number of insts removed by DIE pass");
@@
-118,13
+118,8
@@
bool DCE::runOnFunction(Function &F) {
I->eraseFromParent();
// Remove the instruction from the worklist if it still exists in it.
I->eraseFromParent();
// Remove the instruction from the worklist if it still exists in it.
- for (std::vector<Instruction*>::iterator WI = WorkList.begin();
- WI != WorkList.end(); ) {
- if (*WI == I)
- WI = WorkList.erase(WI);
- else
- ++WI;
- }
+ WorkList.erase(std::remove(WorkList.begin(), WorkList.end(), I),
+ WorkList.end());
MadeChange = true;
++DCEEliminated;
MadeChange = true;
++DCEEliminated;