Skip to content

Commit 30af6fb

Browse files
committed
[VPlan] Group together helpers for retrieving various VPBlocks (NFCI).
Group together functions to retrieve various blocks of a VPlan, as suggested in llvm#114292.
1 parent 466ff3e commit 30af6fb

File tree

1 file changed

+18
-18
lines changed
  • llvm/lib/Transforms/Vectorize

1 file changed

+18
-18
lines changed

llvm/lib/Transforms/Vectorize/VPlan.h

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3825,12 +3825,17 @@ class VPlan {
38253825
VPBasicBlock *getEntry() { return Entry; }
38263826
const VPBasicBlock *getEntry() const { return Entry; }
38273827

3828-
/// Return the VPIRBasicBlock wrapping the header of the scalar loop.
3829-
VPIRBasicBlock *getScalarHeader() const { return ScalarHeader; }
3828+
/// Returns the preheader of the vector loop region.
3829+
VPBasicBlock *getVectorPreheader() {
3830+
return cast<VPBasicBlock>(getVectorLoopRegion()->getSinglePredecessor());
3831+
}
38303832

3831-
/// Return the VPBasicBlock for the preheader of the scalar loop.
3832-
VPBasicBlock *getScalarPreheader() const {
3833-
return cast<VPBasicBlock>(ScalarHeader->getSinglePredecessor());
3833+
/// Returns the VPRegionBlock of the vector loop.
3834+
VPRegionBlock *getVectorLoopRegion() {
3835+
return cast<VPRegionBlock>(getEntry()->getSingleSuccessor());
3836+
}
3837+
const VPRegionBlock *getVectorLoopRegion() const {
3838+
return cast<VPRegionBlock>(getEntry()->getSingleSuccessor());
38343839
}
38353840

38363841
/// Returns the 'middle' block of the plan, that is the block that selects
@@ -3843,6 +3848,14 @@ class VPlan {
38433848
return cast<VPBasicBlock>(getVectorLoopRegion()->getSingleSuccessor());
38443849
}
38453850

3851+
/// Return the VPBasicBlock for the preheader of the scalar loop.
3852+
VPBasicBlock *getScalarPreheader() const {
3853+
return cast<VPBasicBlock>(ScalarHeader->getSinglePredecessor());
3854+
}
3855+
3856+
/// Return the VPIRBasicBlock wrapping the header of the scalar loop.
3857+
VPIRBasicBlock *getScalarHeader() const { return ScalarHeader; }
3858+
38463859
/// Return an iterator range over the VPIRBasicBlock wrapping the exit blocks
38473860
/// of the VPlan, that is leaf nodes except the scalar header. Defined in
38483861
/// VPlanHCFG, as the definition of the type needs access to the definitions
@@ -3953,19 +3966,6 @@ class VPlan {
39533966
LLVM_DUMP_METHOD void dump() const;
39543967
#endif
39553968

3956-
/// Returns the VPRegionBlock of the vector loop.
3957-
VPRegionBlock *getVectorLoopRegion() {
3958-
return cast<VPRegionBlock>(getEntry()->getSingleSuccessor());
3959-
}
3960-
const VPRegionBlock *getVectorLoopRegion() const {
3961-
return cast<VPRegionBlock>(getEntry()->getSingleSuccessor());
3962-
}
3963-
3964-
/// Returns the preheader of the vector loop region.
3965-
VPBasicBlock *getVectorPreheader() {
3966-
return cast<VPBasicBlock>(getVectorLoopRegion()->getSinglePredecessor());
3967-
}
3968-
39693969
/// Returns the canonical induction recipe of the vector loop.
39703970
VPCanonicalIVPHIRecipe *getCanonicalIV() {
39713971
VPBasicBlock *EntryVPBB = getVectorLoopRegion()->getEntryBasicBlock();

0 commit comments

Comments
 (0)