Skip to content

Commit 8833a44

Browse files
committed
[VPlan] Connect scalar header to CFG in VPlan unit test.
This makes sure the VPIRBasicBlock is deleted when the VPlan is destroyed. Fixes #114623.
1 parent ae4fc80 commit 8833a44

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

llvm/unittests/Transforms/Vectorize/VPlanTest.cpp

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -731,10 +731,10 @@ TEST(VPBasicBlockTest, print) {
731731
}
732732

733733
LLVMContext C;
734-
auto *ScalarHeader = BasicBlock::Create(C, "");
735-
// FIXME: This looks wrong.
736-
auto ScalarHeaderVPBB = std::make_unique<VPIRBasicBlock>(ScalarHeader);
737-
VPlan Plan(VPBB0, TC, VPBB1, ScalarHeaderVPBB.get());
734+
auto *ScalarHeader = BasicBlock::Create(C, "scalar.header");
735+
auto * ScalarHeaderVPBB = new VPIRBasicBlock(ScalarHeader);
736+
VPBlockUtils::connectBlocks(VPBB2, ScalarHeaderVPBB);
737+
VPlan Plan(VPBB0, TC, VPBB1, ScalarHeaderVPBB);
738738
std::string FullDump;
739739
raw_string_ostream OS(FullDump);
740740
Plan.printDOT(OS);
@@ -761,6 +761,11 @@ compound=true
761761
"bb2:\l" +
762762
" EMIT vp\<%5\> = mul vp\<%3\>, vp\<%2\>\l" +
763763
" EMIT ret vp\<%5\>\l" +
764+
"Successor(s): ir-bb\<scalar.header\>\l"
765+
]
766+
N2 -> N3 [ label=""]
767+
N3 [label =
768+
"ir-bb\<scalar.header\>:\l" +
764769
"No successors\l"
765770
]
766771
}
@@ -782,7 +787,7 @@ Successor(s): bb2
782787
const char *ExpectedBlock2Str = R"(bb2:
783788
EMIT vp<%5> = mul vp<%3>, vp<%2>
784789
EMIT ret vp<%5>
785-
No successors
790+
Successor(s): ir-bb<scalar.header>
786791
)";
787792
std::string Block2Dump;
788793
raw_string_ostream OS2(Block2Dump);

0 commit comments

Comments
 (0)