OSDN Git Service

use range loop; NFCI
authorSanjay Patel <spatel@rotateright.com>
Mon, 4 Apr 2016 23:05:06 +0000 (23:05 +0000)
committerSanjay Patel <spatel@rotateright.com>
Mon, 4 Apr 2016 23:05:06 +0000 (23:05 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265360 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/Scalar/ConstantProp.cpp

index c974ebb..c2be8de 100644 (file)
@@ -63,9 +63,9 @@ FunctionPass *llvm::createConstantPropagationPass() {
 bool ConstantPropagation::runOnFunction(Function &F) {
   // Initialize the worklist to all of the instructions ready to process...
   std::set<Instruction*> WorkList;
-  for(inst_iterator i = inst_begin(F), e = inst_end(F); i != e; ++i) {
-      WorkList.insert(&*i);
-  }
+  for (Instruction &I: instructions(&F))
+    WorkList.insert(&I);
+
   bool Changed = false;
   const DataLayout &DL = F.getParent()->getDataLayout();
   TargetLibraryInfo *TLI =