[PATCH] D13220: Optimize DeadCodeEliminationPass
Sanjoy Das via llvm-commits
llvm-commits at lists.llvm.org
Mon Sep 28 21:34:55 PDT 2015
sanjoy added a subscriber: sanjoy.
sanjoy added a comment.
Minor generic comments inline.
================
Comment at: lib/Transforms/Scalar/DCE.cpp:102
@@ +101,3 @@
+ // dead as we go.
+ for (unsigned i = 0, e = I->getNumOperands(); i != e; ++i) {
+ Value *OpV = I->getOperand(i);
----------------
I think this can be a range for loop, like
```
for (Use &Op : I->uses()) {
...
```
================
Comment at: lib/Transforms/Scalar/DCE.cpp:112
@@ +111,3 @@
+ // iteration.
+ if (Instruction *OpI = dyn_cast<Instruction>(OpV))
+ if (isInstructionTriviallyDead(OpI, TLI))
----------------
I find `auto *OpI` better -- that way you'll not repeat the type name.
================
Comment at: lib/Transforms/Scalar/DCE.cpp:136
@@ +135,3 @@
+ // the worklist with the entire function's worth of instructions.
+ for (inst_iterator FI = inst_begin(F), FE = inst_end(F); FI != FE;) {
+ Instruction *I = &*FI;
----------------
Can you use `inst_range` here?
Repository:
rL LLVM
http://reviews.llvm.org/D13220
More information about the llvm-commits
mailing list