diff --git a/llvm/tools/hpvm/lib/Transforms/BuildDFG/BuildDFG.cpp b/llvm/tools/hpvm/lib/Transforms/BuildDFG/BuildDFG.cpp
index 2610fb508172069be23f495046ea32ee45d0e3b7..23c38423c6d51e7b94c1f5708a03ce3ec22da3d0 100644
--- a/llvm/tools/hpvm/lib/Transforms/BuildDFG/BuildDFG.cpp
+++ b/llvm/tools/hpvm/lib/Transforms/BuildDFG/BuildDFG.cpp
@@ -29,11 +29,11 @@ bool BuildDFG::runOnModule(Module &M) {
   IntrinsicInst* II;
 
   // Iterate over all functions in the module
-  for (Module::iterator mi = M.begin(), me = M.end(); mi != me; ++mi) {
-    Function* f = &*mi;
-    DEBUG(errs() << "Function: " << f->getName() << "\n");
+  for (auto &Func : M) {
+    Function* F = &Func;
+    DEBUG(errs() << "Function: " << F->getName() << "\n");
 
-    for (inst_iterator i = inst_begin(f), e = inst_end(f); i != e ; ++i) {
+    for (inst_iterator i = inst_begin(F), e = inst_end(F); i != e ; ++i) {
       Instruction* I = &*i; // Grab pointer to Instruction
       if (isViscLaunchIntrinsic(I)) {
         DEBUG(errs() << "------------ Found launch site --------------\n");
@@ -344,51 +344,45 @@ void BuildDFG::BuildGraph (DFInternalNode* N, Function *F) {
 
   // Iterate over all the instructions of a function and look for visc
   // intrinsics.
-  for(auto &BB : *F) {
-    for(auto &Inst : BB) {
-	    Instruction* I = &Inst;
-	    DEBUG(errs() << *I << "\n");
-	    if(IntrinsicInst* II = dyn_cast<IntrinsicInst>(I)) {
-		    DEBUG(errs() << "IntrinsicID = " << II->getIntrinsicID() << ": " << II->getCalledFunction()->getName()<<"\n");
-		    switch(II->getIntrinsicID()) {
-
-			    case Intrinsic::visc_createNode:
-			    case Intrinsic::visc_createNode1D:
-			    case Intrinsic::visc_createNode2D:
-			    case Intrinsic::visc_createNode3D:
-				    handleCreateNode (N, II);
-				    break;
-
-			    case Intrinsic::visc_createEdge:
-				    handleCreateEdge(N, II);
-				    break;
-			    case Intrinsic::visc_bind_input:
-				    handleBindInput(N, II);
-				    break;
-			    case Intrinsic::visc_bind_output:
-				    handleBindOutput(N, II);
-				    break;
-
-				    //TODO: Reconsider launch within a dataflow graph (recursion?)
-			    case Intrinsic::visc_wait:
-			    case Intrinsic::visc_launch:
-				    errs() << "Error: Launch/wait intrinsic used within a dataflow graph\n\t" << *II << "\n";
-				    break;
-
-			    default:
-				    errs() << "Error: Invalid VISC Intrinsic inside Internal node!\n\t" << *II << "\n";
-				    break;
-		    }
-		continue;
-	    }
-	    if(!isa<ReturnInst>(I) && !isa<CastInst>(I)) {
-		    errs() << "Non-intrinsic instruction: " << *I << "\n";
-		    llvm_unreachable("Found non-intrinsic instruction inside an internal node. Only return instruction is allowed!");
-
-	    }
-    }
-
-  }
+  for (inst_iterator i = inst_begin(F), e = inst_end(F); i != e ; ++i) {
+    Instruction* I = &*i; // Grab pointer to Instruction
+    DEBUG(errs() << *I << "\n");
+    if(IntrinsicInst* II = dyn_cast<IntrinsicInst>(I)) {
+      DEBUG(errs() << "IntrinsicID = " << II->getIntrinsicID() << ": " << II->getCalledFunction()->getName()<<"\n");
+      switch(II->getIntrinsicID()) {
+        case Intrinsic::visc_createNode:
+        case Intrinsic::visc_createNode1D:
+        case Intrinsic::visc_createNode2D:
+        case Intrinsic::visc_createNode3D:
+	    handleCreateNode (N, II);
+	    break;
+        case Intrinsic::visc_createEdge:
+	    handleCreateEdge(N, II);
+	    break;
+        case Intrinsic::visc_bind_input:
+	    handleBindInput(N, II);
+	    break;
+       case Intrinsic::visc_bind_output:
+	    handleBindOutput(N, II);
+	    break;
+
+       //TODO: Reconsider launch within a dataflow graph (recursion?)
+       case Intrinsic::visc_wait:
+       case Intrinsic::visc_launch:
+	    errs() << "Error: Launch/wait intrinsic used within a dataflow graph\n\t" << *II << "\n";
+	    break;
+
+       default:
+	    errs() << "Error: Invalid VISC Intrinsic inside Internal node!\n\t" << *II << "\n";
+	    break;
+     }   
+     continue;
+   }   
+   if(!isa<ReturnInst>(I) && !isa<CastInst>(I)) {
+     errs() << "Non-intrinsic instruction: " << *I << "\n";
+     llvm_unreachable("Found non-intrinsic instruction inside an internal node. Only return instruction is allowed!");
+   }
+  } 
 }
 
 char BuildDFG::ID = 0;