Skip to content

Commit 204252e

Browse files
committed
Revert "[VPlan] Support cloning initial VPlan (NFC)."
This reverts commit 5fa985e. Revert as this seems to introduce a call to a pure virtual function on a few configs, e.g. https://lab.llvm.org/buildbot/#/builders/169/builds/11535
1 parent fb86b3d commit 204252e

File tree

2 files changed

+10
-57
lines changed

2 files changed

+10
-57
lines changed

llvm/lib/Transforms/Vectorize/VPlan.cpp

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1168,16 +1168,11 @@ VPlan *VPlan::duplicate() {
11681168
const auto &[NewEntry, __] = cloneFrom(Entry);
11691169

11701170
BasicBlock *ScalarHeaderIRBB = getScalarHeader()->getIRBasicBlock();
1171-
VPIRBasicBlock *NewScalarHeader = nullptr;
1172-
if (getScalarHeader()->getNumPredecessors() == 0) {
1173-
NewScalarHeader = createVPIRBasicBlock(ScalarHeaderIRBB);
1174-
} else {
1175-
NewScalarHeader = cast<VPIRBasicBlock>(*find_if(
1176-
vp_depth_first_shallow(NewEntry), [ScalarHeaderIRBB](VPBlockBase *VPB) {
1177-
auto *VPIRBB = dyn_cast<VPIRBasicBlock>(VPB);
1178-
return VPIRBB && VPIRBB->getIRBasicBlock() == ScalarHeaderIRBB;
1179-
}));
1180-
}
1171+
VPIRBasicBlock *NewScalarHeader = cast<VPIRBasicBlock>(*find_if(
1172+
vp_depth_first_shallow(NewEntry), [ScalarHeaderIRBB](VPBlockBase *VPB) {
1173+
auto *VPIRBB = dyn_cast<VPIRBasicBlock>(VPB);
1174+
return VPIRBB && VPIRBB->getIRBasicBlock() == ScalarHeaderIRBB;
1175+
}));
11811176
// Create VPlan, clone live-ins and remap operands in the cloned blocks.
11821177
auto *NewPlan = new VPlan(cast<VPBasicBlock>(NewEntry), NewScalarHeader);
11831178
DenseMap<VPValue *, VPValue *> Old2NewVPValues;
@@ -1192,7 +1187,8 @@ VPlan *VPlan::duplicate() {
11921187
NewPlan->BackedgeTakenCount = new VPValue();
11931188
Old2NewVPValues[BackedgeTakenCount] = NewPlan->BackedgeTakenCount;
11941189
}
1195-
if (TripCount && TripCount->isLiveIn())
1190+
assert(TripCount && "trip count must be set");
1191+
if (TripCount->isLiveIn())
11961192
Old2NewVPValues[TripCount] =
11971193
NewPlan->getOrAddLiveIn(TripCount->getLiveInIRValue());
11981194
// else NewTripCount will be created and inserted into Old2NewVPValues when
@@ -1205,11 +1201,9 @@ VPlan *VPlan::duplicate() {
12051201
NewPlan->UFs = UFs;
12061202
// TODO: Adjust names.
12071203
NewPlan->Name = Name;
1208-
if (TripCount) {
1209-
assert(Old2NewVPValues.contains(TripCount) &&
1210-
"TripCount must have been added to Old2NewVPValues");
1211-
NewPlan->TripCount = Old2NewVPValues[TripCount];
1212-
}
1204+
assert(Old2NewVPValues.contains(TripCount) &&
1205+
"TripCount must have been added to Old2NewVPValues");
1206+
NewPlan->TripCount = Old2NewVPValues[TripCount];
12131207

12141208
// Transfer all cloned blocks (the second half of all current blocks) from
12151209
// current to new VPlan.

llvm/unittests/Transforms/Vectorize/VPlanTest.cpp

Lines changed: 0 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -904,47 +904,6 @@ No successors
904904
EXPECT_EQ(ExpectedStr, FullDump);
905905
}
906906
}
907-
908-
TEST_F(VPBasicBlockTest, cloneAndPrint) {
909-
VPlan &Plan = getPlan(nullptr);
910-
VPBasicBlock *VPBB0 = Plan.getEntry();
911-
912-
VPInstruction *I1 = new VPInstruction(Instruction::Add, {});
913-
VPInstruction *I2 = new VPInstruction(Instruction::Sub, {I1});
914-
VPInstruction *I3 = new VPInstruction(Instruction::Br, {I1, I2});
915-
916-
VPBasicBlock *VPBB1 = Plan.createVPBasicBlock("");
917-
VPBB1->appendRecipe(I1);
918-
VPBB1->appendRecipe(I2);
919-
VPBB1->appendRecipe(I3);
920-
VPBB1->setName("bb1");
921-
VPBlockUtils::connectBlocks(VPBB0, VPBB1);
922-
923-
const char *ExpectedStr = R"(digraph VPlan {
924-
graph [labelloc=t, fontsize=30; label="Vectorization Plan\n for UF\>=1\n"]
925-
node [shape=rect, fontname=Courier, fontsize=30]
926-
edge [fontname=Courier, fontsize=30]
927-
compound=true
928-
N0 [label =
929-
"preheader:\l" +
930-
"Successor(s): bb1\l"
931-
]
932-
N0 -> N1 [ label=""]
933-
N1 [label =
934-
"bb1:\l" +
935-
" EMIT vp\<%1\> = add\l" +
936-
" EMIT vp\<%2\> = sub vp\<%1\>\l" +
937-
" EMIT br vp\<%1\>, vp\<%2\>\l" +
938-
"No successors\l"
939-
]
940-
}
941-
)";
942-
// Check that printing a cloned plan produces the same output.
943-
std::string FullDump;
944-
raw_string_ostream OS(FullDump);
945-
Plan.duplicate()->printDOT(OS);
946-
EXPECT_EQ(ExpectedStr, FullDump);
947-
}
948907
#endif
949908

950909
using VPRecipeTest = VPlanTestBase;

0 commit comments

Comments
 (0)