@@ -440,6 +440,26 @@ class VPBlockBase {
440440 Successors.erase (Pos);
441441 }
442442
443+ // / This function replaces one predecessor with another, useful when
444+ // / trying to replace an old block in the CFG with a new one.
445+ void replacePredecessor (VPBlockBase *Old, VPBlockBase *New) {
446+ auto I = find (Predecessors, Old);
447+ assert (I != Predecessors.end ());
448+ assert (Old->getParent () == New->getParent () &&
449+ " replaced predecessor must have the same parent" );
450+ *I = New;
451+ }
452+
453+ // / This function replaces one successor with another, useful when
454+ // / trying to replace an old block in the CFG with a new one.
455+ void replaceSuccessor (VPBlockBase *Old, VPBlockBase *New) {
456+ auto I = find (Successors, Old);
457+ assert (I != Successors.end ());
458+ assert (Old->getParent () == New->getParent () &&
459+ " replaced successor must have the same parent" );
460+ *I = New;
461+ }
462+
443463protected:
444464 VPBlockBase (const unsigned char SC, const std::string &N)
445465 : SubclassID(SC), Name(N) {}
@@ -556,26 +576,6 @@ class VPBlockBase {
556576 return getEnclosingBlockWithPredecessors ()->getSinglePredecessor ();
557577 }
558578
559- // / This function replaces one predecessor with another, useful when
560- // / trying to replace an old block in the CFG with a new one.
561- void replacePredecessor (VPBlockBase *Old, VPBlockBase *New) {
562- auto I = find (Predecessors, Old);
563- assert (I != Predecessors.end ());
564- assert (Old->getParent () == New->getParent () &&
565- " replaced predecessor must have the same parent" );
566- *I = New;
567- }
568-
569- // / This function replaces one successor with another, useful when
570- // / trying to replace an old block in the CFG with a new one.
571- void replaceSuccessor (VPBlockBase *Old, VPBlockBase *New) {
572- auto I = find (Successors, Old);
573- assert (I != Successors.end ());
574- assert (Old->getParent () == New->getParent () &&
575- " replaced successor must have the same parent" );
576- *I = New;
577- }
578-
579579 // / Set a given VPBlockBase \p Successor as the single successor of this
580580 // / VPBlockBase. This VPBlockBase is not added as predecessor of \p Successor.
581581 // / This VPBlockBase must have no successors.
0 commit comments