[PATCH] D23880: TailDuplication: Record blocks that received the duplicated block. NFC.

Kyle Butt via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 26 11:46:04 PDT 2016


iteratee updated this revision to Diff 69418.
iteratee marked an inline comment as done.
iteratee added a comment.

use std::move


Repository:
  rL LLVM

https://reviews.llvm.org/D23880

Files:
  include/llvm/CodeGen/TailDuplicator.h
  lib/CodeGen/TailDuplicator.cpp

Index: lib/CodeGen/TailDuplicator.cpp
===================================================================
--- lib/CodeGen/TailDuplicator.cpp
+++ lib/CodeGen/TailDuplicator.cpp
@@ -119,8 +119,13 @@
 }
 
 /// Tail duplicate the block and cleanup.
-bool TailDuplicator::tailDuplicateAndUpdate(bool IsSimple,
-                                            MachineBasicBlock *MBB) {
+/// \p IsSimple - return value of isSimpleBB
+/// \p MBB - block to be duplicated
+/// \p DuplicatedPreds - if non-null, \p DuplicatedPreds will contain a list of
+///     all Preds that received a copy of \p MBB.
+bool TailDuplicator::tailDuplicateAndUpdate(
+    bool IsSimple, MachineBasicBlock *MBB,
+    SmallVectorImpl<MachineBasicBlock*> *DuplicatedPreds) {
   // Save the successors list.
   SmallSetVector<MachineBasicBlock *, 8> Succs(MBB->succ_begin(),
                                                MBB->succ_end());
@@ -216,6 +221,9 @@
   if (NewPHIs.size())
     NumAddedPHIs += NewPHIs.size();
 
+  if (DuplicatedPreds)
+    *DuplicatedPreds = std::move(TDBBs);
+
   return true;
 }
 
Index: include/llvm/CodeGen/TailDuplicator.h
===================================================================
--- include/llvm/CodeGen/TailDuplicator.h
+++ include/llvm/CodeGen/TailDuplicator.h
@@ -57,7 +57,13 @@
   bool shouldTailDuplicate(bool IsSimple, MachineBasicBlock &TailBB);
   /// Returns true if TailBB can successfully be duplicated into PredBB
   bool canTailDuplicate(MachineBasicBlock *TailBB, MachineBasicBlock *PredBB);
-  bool tailDuplicateAndUpdate(bool IsSimple, MachineBasicBlock *MBB);
+  /// Tail duplicate a single basic block into its predecessors, and then clean
+  /// up.
+  /// If \p DuplicatePreds is not null, it will be updated to contain the list
+  /// of predecessors that received a copy of \p MBB.
+  bool tailDuplicateAndUpdate(
+      bool IsSimple, MachineBasicBlock *MBB,
+      SmallVectorImpl<MachineBasicBlock*> *DuplicatedPreds = nullptr);
 
 private:
   typedef TargetInstrInfo::RegSubRegPair RegSubRegPair;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D23880.69418.patch
Type: text/x-patch
Size: 2035 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160826/21d301be/attachment.bin>


More information about the llvm-commits mailing list