[PATCH] D48202: Generalize MergeBlockIntoPredecessor. Replace uses of MergeBasicBlockIntoOnlyPred.
    Chandler Carruth via Phabricator via llvm-commits 
    llvm-commits at lists.llvm.org
       
    Wed Jun 20 11:24:02 PDT 2018
    
    
  
chandlerc requested changes to this revision.
chandlerc added a comment.
This revision now requires changes to proceed.
Still a few things left, but really close.
================
Comment at: lib/CodeGen/CodeGenPrepare.cpp:522
+  SmallVector<WeakTrackingVH, 16> Blocks;
+  for (Function::iterator I = std::next(F.begin()), E = F.end(); I != E;)
+    Blocks.push_back(&*I++);
----------------
You can use a range based loop here now that you're putting them into a temporary array.
================
Comment at: lib/CodeGen/CodeGenPrepare.cpp:598
   // Note that this intentionally skips the entry block.
-  for (Function::iterator I = std::next(F.begin()), E = F.end(); I != E;) {
-    BasicBlock *BB = &*I++;
+  // FIXME: use one line initializer?
+  SmallVector<WeakTrackingVH, 16> Blocks;
----------------
Due to building a WeakTrackingVH, may not work.
But why not use a range based loop below? should be safe now.
================
Comment at: lib/CodeGen/CodeGenPrepare.cpp:779-780
+      MergeBlockIntoPredecessor(DestBB);
+      // Note: BB will not be deleted on this path, its single predecessor will.
+      LLVM_DEBUG(dbgs() << "AFTER:\n" << *SinglePred << "\n\n\n");
       return;
----------------
This seems like a bug then -- we can't print the `SinglePred` after it is deleted...
Repository:
  rL LLVM
https://reviews.llvm.org/D48202
    
    
More information about the llvm-commits
mailing list